×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

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)