problem with MessageBox
-
Hello everybody,I have just purchased Visual Studio 2005 and I have problem with the MessageBox funtion!!! when I write for example MessageBoc("Hello") an error occurs: cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast why? In Visual Studio 6 there is no such problem please help
-
Hello everybody,I have just purchased Visual Studio 2005 and I have problem with the MessageBox funtion!!! when I write for example MessageBoc("Hello") an error occurs: cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast why? In Visual Studio 6 there is no such problem please help
check ur coding MessageBox("Hello") ----->>Right MessageBoc("Hello") ----->>Wrong Sachin Think of your goal when you are confused.
-
Hello everybody,I have just purchased Visual Studio 2005 and I have problem with the MessageBox funtion!!! when I write for example MessageBoc("Hello") an error occurs: cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast why? In Visual Studio 6 there is no such problem please help
It's because unicode is enabled. You have two options: either disable unicode or use unicode strings: For the first solution, go into the project properties, C/C++ tab, preprocessor. In the "Preprocessor definitions" option, (you have to check on the grey button with '...' on it), uncheck "Inherit from parent or project defaults". This will disable unicode. For the second solution, use
MessageBox(_T("Hello"));
. This will tell the compiler that "Hello" is an unicode string.
Cédric Moonen Software developer
Charting control -
check ur coding MessageBox("Hello") ----->>Right MessageBoc("Hello") ----->>Wrong Sachin Think of your goal when you are confused.
It was a typo in his post only. Otherwise the error message would have been different: 'MessageBoc': identifier not found
Cédric Moonen Software developer
Charting control -
Hello everybody,I have just purchased Visual Studio 2005 and I have problem with the MessageBox funtion!!! when I write for example MessageBoc("Hello") an error occurs: cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast why? In Visual Studio 6 there is no such problem please help