MessageBoxW and converting to LPCWSTR
-
Hi MessageBox(NULL, "Hello World", "Message Box Title -- Hello World", MB_OK); Error: error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [12]' to 'LPCWSTR' IDE:VS2005 I don't understand why it gives this error. Can you please tell me what the problem is and how i can solve it. Thanks
-
Hi MessageBox(NULL, "Hello World", "Message Box Title -- Hello World", MB_OK); Error: error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [12]' to 'LPCWSTR' IDE:VS2005 I don't understand why it gives this error. Can you please tell me what the problem is and how i can solve it. Thanks
hi, L"Hellow World" in the MessageBox.
Uday kiran
-
Hi MessageBox(NULL, "Hello World", "Message Box Title -- Hello World", MB_OK); Error: error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [12]' to 'LPCWSTR' IDE:VS2005 I don't understand why it gives this error. Can you please tell me what the problem is and how i can solve it. Thanks
The default project charset setting in VS2005 is using UNICODE, so the
MessageBox
maps toMessageBoxW
, which takes unicode strings as its input. You can 1. changing your project's setting from using UNICODE to MBCS 2. enclose each of the string appeared in your source files with_T()
. Or you can do both. The _T macro will map the string to wide char string constant if the project is set to use UNICODE, and will map the string to normal ANSI string constants if the project is set to use MBCS charset. -
The default project charset setting in VS2005 is using UNICODE, so the
MessageBox
maps toMessageBoxW
, which takes unicode strings as its input. You can 1. changing your project's setting from using UNICODE to MBCS 2. enclose each of the string appeared in your source files with_T()
. Or you can do both. The _T macro will map the string to wide char string constant if the project is set to use UNICODE, and will map the string to normal ANSI string constants if the project is set to use MBCS charset. -
thanks for fast reply but for _T("Message Box Title -- Hello World") error C3861: '_T': identifier not found for L"Message Box Title -- Hello World" same error C2664
-
sorry friends L is ok. It works.Thank you. But _T macro can not find it says. How can i tell compiler to see this macro.I opened only empty win. application. Thanks again. Edit/Delete Message
replace
_T()
withTEXT()
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
replace
_T()
withTEXT()
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
sorry friends L is ok. It works.Thank you. But _T macro can not find it says. How can i tell compiler to see this macro.I opened only empty win. application. Thanks again. Edit/Delete Message
sawerr wrote:
But _T macro can not find it says.
What does this mean? _T() macro is defined in tchar.h; But again finally expands to
L""
Prasad Notifier using ATL
-
thanks for fast reply but for _T("Message Box Title -- Hello World") error C3861: '_T': identifier not found for L"Message Box Title -- Hello World" same error C2664
what type of project u r using?