|
-
July 13th, 2004, 03:40 PM
#1
char * -> LPWSTR
I'm currently trying to add listview groups to my listview control and for some reason the parameter asked is LPWSTR and not the regular LPSTR.
Any way to convert so I can add my regular text to the item.
LVGROUP lvg;
char gtext[256];
....
lvg.pszHeader = gtext;
ERROR: c:\VCPP_Projects NET\DCX\ListView.cpp(58): error C2440: '=' : cannot convert from 'char [256]' to 'LPWSTR'
Using regular WIN32 API and C/C++ to build the code.
Thanx
David
-
July 13th, 2004, 04:05 PM
#2
Hi ClickHeRe,
Try below. See http://msdn.microsoft.com/library/de...otes_tn059.asp.
Jeff
Code:
USES_CONVERSION
WCHAR* psz = A2W( "Test" );
-
July 13th, 2004, 04:10 PM
#3
 Originally Posted by ClickHeRe
I'm currently trying to add listview groups to my listview control and for some reason the parameter asked is LPWSTR and not the regular LPSTR.
Any way to convert so I can add my regular text to the item.
That reason is most likely that you are building a UNICODE project (with UNICODE and _UNICODE #defined in your preprocessor settings). So either switch to non-UNICODE (if you don't need it), or supply a wide string instead:Better yet, use TCHAR instead of WCHAR, and your code will compile for both UNICODE and non-UNICODE builds.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|