Sign in to follow this  
Wasif Hyder

Help With Win32 Program

Recommended Posts

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

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

           MessageBox ( NULL, 

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

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

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