开发者

casting LPCWSTR to LPCSTR

got this code from a website that helped me in creating buttons and stuff. the buttons work but for some reason im getting an compiler error with the creating a static.

cannot convert from 'const wchar_t [5]' to 'char'

cannot convert parameter 3 from 'char' to 'LPCWSTR'

is there a simply way to fix this? i tried casting lyrics into another variable and making it just a char.

  static char *lyrics = TEXT("Dood");



switch (message)
{

case WM_CREATE:
{
       CreateWindow(TEXT("button"), TEXT("Beep"),    
                 WS_VISIBLE | WS_CHILD ,
                 20, 300, 80, 25,        
                 hWnd, (HMENU) 1, NULL, NULL);    

    CreateWindow(TEXT("button"), TEXT("Quit"),    
                 WS_VISIBLE | WS_CHILD ,
                 120, 300, 80, 25,        
                 hWnd, (HMENU) 2, NULL, NULL);    

     CreateWindow(TEX开发者_如何学编程T("STATIC"), lyrics, 
                WS_CHILD | WS_VISIBLE | SS_LEFT,
                20, 20, 300, 230,
                hWnd, (HMENU) 1, NULL, NULL);


Try this instead:

static TCHAR *lyrics = TEXT("Dood"); 

With the compiler settings you appear to have, TCHAR will be converted to wchar_t.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜