Hi, I'm pretty new to windows programming, and I'm trying to learn from an example. However, I'm encountering some compiler errors that I think are caused by my strings not being made up of wide characters. (correct me, i could very easily be WAY off)

winMain() requires parameters of the LPCWSTR type, and I've tried a simple explicit cast, but that results in my title as blocks, which im sure is a result of a cast that can/should not really be made.

I guess the question is, since the strings are not coming from a variable or anywhere else, is there an easy way to make every string typed (ex "My Title") in unicode, or maybe just of the type LPCWSTR? Whats the standard way of doing this?

9 Years
Discussion Span
Last Post by oblivion4


TCHAR tword[10] = TEXT("WORLD");

Instead of the TEXT macro used above you could also use L"WORLD" or _T("WORLD"). At least they worked when I ran up against this hurdle.


Thank you very much, that works perfectly. probably much better than what i was thinking of.


Edit: btw, in my particular compiler, VS2005, the _T() trick does not work, but the L does. Thanks again.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.