Sign in to follow this  
Double Trouble

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

Recommended Posts

Double Trouble    122
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

Share this post


Link to post
Share on other sites
Scet    960
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.

Share this post


Link to post
Share on other sites
Double Trouble    122
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this