I have a very big problem... I' ve started today morning programming in Windows.h but I can't figure out why it gave me this problem as I litteraly copy the thing in the tut. ( https://youtu.be/8GCvZs55mEM?t=5m20s ) (I put the link to start the video when occurs my error)
The only thing I noticed is that in the tut it uses a LPCSTR variable for test, but my editor (Visual Studio Code) signal a LPCWSTR variable.
Sorry for the bad English.
#include <windows.h>
using namespace std;
int WINAPI WinMain (HINSTANCE hInts, HINSTANCE hPrevInst, LPSTR args, int ncmdshow)
{
MessageBox(NULL, "Ciao!", "La prima GUI", MB_OK, );
return 0;
}
How can I solve?
In the comment:
Now the error don't show up, thanks a lot. But there is a problem... The editor don' t built the application. The Console give:
Executing task: g++ -g main.cpp -o Program <
main.cpp: In function 'int WinMain(void *, void *, char *, int)':
main.coo:8: pasing '__wchar_t *' as argument 2 of 'MessageBox(void *, const char *, const char *, UINT)'
Obviously not a good tutorial. Do it like like this
MessageBox(NULL, L"Ciao!", L"La prima GUI", MB_OK);
Using L
changes the string literal so that it uses wide characters. A wide character string literal can be converted to the type LPCWSTR
, a normal string literal cannot.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.