×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

Vc++ MessageBox(0, "Test Message","Test",MB_OK);

Hi there, I use the windows SDK fuction:

MessageBox(0, "Test Message","Test",MB_OK)

in VC++6. Obviously, it should work. But Vc compiler tells me I should use it like:

MessageBox(0, unsigned short * ,unsigned short *, int ) .

Can anybody tell me why?

Thanks a lot.

Error info:
TestRecord.cpp(256) :
error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [27]' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / Vc++ MessageBox(0, "Test Message","Test",MB_OK);
    Hi there, I use the windows SDK fuction:

    MessageBox(0, "Test Message","Test",MB_OK)

    in VC++6. Obviously, it should work. But Vc compiler tells me I should use it like:

    MessageBox(0, unsigned short * ,unsigned short *, int ) .

    Can anybody tell me why?

    Thanks a lot.

    Error info:
    TestRecord.cpp(256) :
    error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [27]' to 'const unsigned short *'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    • 查一下你的 build->Set Active Configuration,是不是unicode?
    • Are you using it in a class derived from a window class?
      If so, use :: in the front of the function to call the API function.
    • Yes, it's in uncode mode. I changed to debug mode, it works perfectly. I appreciate ur help.
    • too simple: MessageBox(0, _T("Test Message"),_T("Test"),MB_OK)