#include<windows.h>

BOOL isIn64BitMode () {
BOOL result = FALSE;
BOOL(*WINAPI IsWow64Process)(HANDLE,BOOL*) = NULL;
IsWow64Process = GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process");
if (IsWow64Process) {
if (!IsWow64Process(GetCurrentProcess(), &result)) {
char msg[256] = {0};
sprintf(msg, "The system call to determine if you are on a 64 bit machine has failed.\r\nError code: %d\r\n", GetLastError());
MessageBox(NULL, msg, "64 bit test", MB_ICONERROR | MB_OK);
result = FALSE;
}}
return result;
}

int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpArg, int windowStyle) {
char* msg = NULL;
if (isIn64BitMode()) msg = "You are in 64 bit mode";
else msg = "You are in 32 bit mode";
MessageBox(NULL, msg, "64 bit test", MB_OK | MB_ICONINFORMATION);
return 0;
}
