I am totally new to C++ (I just had my first 30 min playing with it). I have tried to follow this tutorial, but the first code snippet was not working:
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
return 0;
}
The compiler had problem converting the two string value into LPCWSTR type.
The error message was this:
argument of type "char" is incompatible with parameter of type "LPCWSTR"
The first solution was to prefix it with an L
to convert it.
MessageBox(NULL, L"Goodbye, cruel world!", L"Note", MB_OK);
But then I found the second solution here, which was setting the character set from unicode to not set:
My firs question is whats happening when I prefix the strings with an F
? Is it the same as casting in C#?
// Casting example, C# code
double x = 1234.7;
int a;
a = (int)x;
My second question is whats happening here exactly when I set the character set, and why automatic casting is possible when it is set to Not Set
?