When I use VS 2012, I get this error to display a message box:
error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [31]' to 'LPCWSTR'
This is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13
#include "stdafx.h"
#include <windows.h>
//#include <windowsx.h>
int WINAPI WinMain(HINSTANCE hIn , HINSTANCE hPrevInce,
LPSTR lpe, int nShowd)
{
MessageBox(NULL, "hayate has hacked your system!",
"Public Security Section 9", MB_OK | MB_ICONEXCLAMATION);
return 0;
}
There are pros and cons of each way, so you'll have to decide for yourself which way you'd like to go. Essentially you need to tell the compiler that "hayate has hacked your system!" and "Public Security Section 9" are strings, using a prefix such as TEXT, L or _T, depending on your UNICODE needs. So, your function call would become something like:
1 2
MessageBox(NULL, TEXT("hayate has hacked your system!"),
TEXT("Public Security Section 9"), MB_OK | MB_ICONEXCLAMATION);