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?

Recommended Answers

All 2 Replies

Yes.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.