0

I am learning how to make Windows in C++, and I have a problem:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE hPrevInstance,
				   LPSTR lpCmdLine,
				   int nShowCmd)
{
    MessageBox(NULL,
               L"Hello World!",
               L"TEST",
               MB_ICONEXCLAMATION | MB_OK);
	return 0;
}

I get this error: Error 1 error C2664: 'MessageBoxA' : cannot convert parameter 2 from 'const wchar_t [13]' to 'LPCSTR' 12

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by fuggles
0

Your code should be:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE hPrevInstance,
				   LPSTR lpCmdLine,
				   int nShowCmd)
{
    MessageBox(NULL, "Hello World!",
               "TEST",
               MB_ICONEXCLAMATION | MB_OK);
	return 0;
}

Your problem was on lines 8, and 9 :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.