I really don't care about size anymore but when I want to try for the smallest I use TinyC.
Using bc9Basic I get this translation using standard windowsx.h message crackers.
32 - 3584
64 - 5120
// *********************************************************************
// Created with bc9Basic - BASIC To C/C++ Translator (V) 9.1.9.0 (2014/09/08)
// The bc9Basic translator (bc9.exe) was compiled with
// g++ (tdm64-2) 4.8.1
// ----------------------------------------------------------------------
// BCX (c) 1999 - 2009 by Kevin Diggins
// *********************************************************************
/* -------------------------------*/
/* Tiny C support for LinkRes2Exe */
/* -------------------------------*/
int dummy __attribute__ ((section(".rsrc")));
/* -------------------------------*/
// Translated for compiling with a C Compiler
// On MS Windows
// *********************************************************************
typedef char *PCHAR, *LPCH, *PCH, *NPSTR, *LPSTR, *PSTR;
#include <windows.h>
#include <windowsx.h>
// *************************************************
// User's GLOBAL ENUM blocks
// *************************************************
// *************************************************
// System Defined Constants
// *************************************************
typedef const char* ccptr;
#define CCPTR const char*
#define cfree free
#define WAITKEY system("pause")
#define cSizeOfDefaultString 2048
// *************************************************
// User Defined Constants
// *************************************************
// *************************************************
// User Defined Types And Unions
// *************************************************
// *************************************************
// User Global Variables
// *************************************************
// *************************************************
// Standard Macros
// *************************************************
#define BOR |
// *************************************************
// User Prototypes
// *************************************************
int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int);
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
void WndProc_OnDestroy (HWND);
// *************************************************
// User Global Initialized Arrays
// *************************************************
// *************************************************
// Runtime Functions
// *************************************************
// ************************************
// User Subs and Functions
// ************************************
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR CmdLine, int CmdShow)
{
char szClassName[] = "Form4";
WNDCLASSEX wcx = {0};
HWND hWnd = {0};
MSG uMsg = {0};
wcx.cbSize = sizeof( wcx);
wcx.style = CS_HREDRAW BOR CS_VREDRAW;
wcx.lpfnWndProc = WndProc;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = hInst;
wcx.hIcon = LoadIcon( NULL, IDI_WINLOGO);
wcx.hCursor = LoadCursor( NULL, IDC_ARROW);
wcx.hbrBackground = ( HBRUSH) GetStockObject( WHITE_BRUSH);
wcx.lpszMenuName = NULL;
wcx.lpszClassName = szClassName;
hWnd = CreateWindowEx( 0, szClassName, szClassName, WS_OVERLAPPEDWINDOW, 75, 75, 320, 305, HWND_DESKTOP, (HMENU) 0, hInst, 0);
if(hWnd == 0 )
{
MessageBox (GetActiveWindow(), ("Problem"), "", 0 );
return 0;
}
ShowWindow(hWnd, SW_SHOW);
while(GetMessage( &uMsg, NULL, 0, 0))
{
TranslateMessage( &uMsg);
DispatchMessage( &uMsg);
}
return uMsg.wParam;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
HANDLE_MSG (hwnd, WM_DESTROY, WndProc_OnDestroy);
default:
return DefWindowProc (hwnd, msg, wParam, lParam);
}
}
void WndProc_OnDestroy (HWND hWnd)
{
PostQuitMessage(0);
}