Jump to content
  • Advertisement
Sign in to follow this  
Wasif Hyder

Help With Win32 Program

This topic is 3747 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

#define WIN32_LEAN_AND_MEAN
#include "stdafx.h"
#include <windows.h> 
#include <windowsx.h>

int WINAPI WinMain    ( HINSTANCE   hInstance,
		        HINSTANCE   hPrevInstance,
                        LPSTR       lpCmdLine,
                        int         nCmdShow )
{

           MessageBox ( NULL, 
			"Title",
                        "Hello", 
			MB_OK | MB_ICONEXCLAMATION );
					           
return(0);

}
I'm having issues with this code. Here's the error according to the compiler error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [6]' to 'LPCWSTR' The error is on this line
 MB_OK | MB_ICONEXCLAMATION ); 

Share this post


Link to post
Share on other sites
Advertisement
thanks moonshoe, but jpetrie already helped me with it.

and no, sadly your solution isnt correct

but thanks a lot for ur interest

i appreciate it

Share this post


Link to post
Share on other sites
Unicode problem - this thread may be of some use: http://www.gamedev.net/community/forums/topic.asp?topic_id=420231

Share this post


Link to post
Share on other sites
The problem was that the compiler was set to use Unicode strings (thus the call to MessageBoxW) but the parameters were regular string literals, not wide ones.

The solution was either to use wide literals (L"string") or set the compiler to use Multibyte strings. One or the other.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!