Dev-C++ / Visual Studio --- Why wont it work?

Started by
2 comments, last by jwenting 18 years, 1 month ago
Good Evening! I have some trouble trying to creata a simple window (I have only been doing console apps before). Well, so I learned how to make this window and this is the source code that I'm using: http://www.alsprogrammingresource.com/basic_window_source.html But it will only work for me in Dev-C++ and not in Visual Studio 2005. Why is that? Is there anything I can do to make it work in Visual Studio? When I try to compile this in Visual Studio I get 4 errors and 1 warning: : error C2440: '=' : cannot convert from 'const char [16]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [37]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [16]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [24]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of data
Advertisement
Looks like your version of VC is set to use multi-byte / wide characters( characters larger than 1 byte ). For the windows API, functions ending with W use wide characters and functions ending with A uses plain ASCII. Win32 functions without either(like just "MessageBox") will use whichever one the compiler is set to.

You'll have to toy around with your project or compiler settings in VC to set it to use plain ASCII.
Thank you for your answer!

Unfortunately I couln't find where to change my settings to 'plain ASCII'. Somebody else who uses Visual Studio 2005 and know how to change this?

Thank you in advance!

Best Regards..
DT
in VC2005, change "multibyte character" in the compiler options to "not set".

This topic is closed to new replies.

Advertisement