I posted a comment that because of the Redis cache issues hasnt yet re-appeared .. anyway, In VS2019, I generated a 'Windows Desktop Application', copied your one line thus
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
::MessageBox(NULL, _T("Hello World"), _T("MFC Programming"), MB_OK);
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_CPQATEST1, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
compiled and ran, no issues - I have VS2012 somewhere, Im not sure what the equivalent project is, they keep moving all the options around :-(
Update 1 : In VS2012 I generated a simple Dialog based MFC app, and put the ::MessageBox line in the OnInitDialog() code, and it ran there as well ..
Update 2 : In VS2012, I went New Project -> Win32 Console Application -> Next -> Windows Application, put the line
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPTSTR lpCmdLine,
_In_ int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
::MessageBox(NULL, _T("Hello World"), _T("MFC Programming"), MB_OK);
and again no issues.
FWIW (and iirc), ::MessageBox is a Win32 API function, NOT a MFC Class/Construct