views:

80

answers:

1

Hi,

I was going to start with Win32 app development. Before I could get the first window to display i was ready to give up! I was overwhelmed by the number of datatypes you need to know about before you can write a simple WinMain and WndProc. (unless you copy-paste of course!)

Especially these -

LPSTR

LPCSTR

LPWSTR

LPCWSTR

Can someone point me to the right article that explains these with respect to Win32 programming? Which ones should I know about, which ones are needed in what situation, when to go for Unicode, what is multi-byte char set, and all the related stuff.

And the conversion to/from these datatypes to char* and char[] and whatnot, when calling Win32 API functions is a pain.

It is all so confusing.

Thanks for the help.

+2  A: 

The pattern is relatively simple:

LPSTR = zero-terminated string of char

LPCSTR = constant zero-terminated string of char (C == constant)

LPWSTR = zero-terminated string of wchar_t (W == wide character)

LPCWSTR = constant zero-terminated string of wchar_t (C and W)

For details and explanations see e.g. http://www.codeproject.com/KB/string/cppstringguide1.aspx

The linked article also contains advice when to use Unicode in your application and when not.

Sebastian
+1 - hey, just had a glance at the article. Looks like it answers a LOT of my string/charset questions. Thanks! :)
Senthil
You're welcome. And yes, it is ridiculous at first, but makes some kind of sense after a while.
Sebastian
Going through it... It is as if that article was made to order! :) Couldn't have asked for more.
Senthil