In HelloWin program (Petzold's book) there are 19 functions, 5 structures, 8 new data types, and 12 constants.
This is too much for a hello program. Here, we have a set of programs that adds these entities 1 at a time per program

###########################################################################
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
return 0;
}
###########################################################################
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
//MessageBeep(0);
Beep(500,500);
}
###########################################################################
#include <windows.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{

MessageBox(NULL,"Hello!", "My own box", MB_OK);

}
###########################################################################
#include <stdio.h>
#include <windows.h>
//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
printf("hInst=%x\n", hInst);
printf("hPrevInst=%x\n", hPrevInst);
MessageBox(NULL,"Hello!", "My own box", MB_OK);
}
###########################################################################
#include <windows.h>

//---------------------------------------------------------------------------
int PASCAL WinMain (HANDLE hInstance, HANDLE hPrevInst, LPSTR lpszCP, int nCS)
{
ExitWindows(EW_RESTARTWINDOWS,0);
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//---------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
WinExec("write", SW_SHOW);
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
WinHelp(NULL, "", HELP_INDEX, (ULONG_PTR)NULL);
}
###########################################################################
char buf[100];


GetWindowsDirectory(buf, 100);
SetWindowText(hwnd,buf);
MessageBox(hwnd,"","Win Dir",MB_OK);

GetSystemDirectory(buf, 100);
SetWindowText(hwnd,buf);
MessageBox(hwnd,"","Sys Dir",MB_OK);

i=GetVersion();
wsprintf(buf, "%04x",i);
SetWindowText(hwnd,buf);
MessageBox(hwnd,"","Win Ver",MB_OK);

n=GetNumTasks();
wsprintf(buf, "%d",n);
SetWindowText(hwnd,buf);
MessageBox(hwnd,"","Num Tsk",MB_OK);
###########################################################################
#include <stdio.h>
#include <windows.h>
//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
//print command line without program name
printf("%s\n", lpszCP);

MessageBox(NULL,"Hello!", "My own box", MB_OK);
}
###########################################################################
#include <stdio.h>
#include <windows.h>
//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
SYSTEM_INFO rSystemInfo;
GetSystemInfo( &rSystemInfo );

printf("System Info:\n");
printf("wProcessorArchitecture: %d\n", rSystemInfo.wProcessorArchitecture);
printf("dwPageSize: %d\n", rSystemInfo.dwPageSize);
printf("dwNumberOfProcessors: %d\n", rSystemInfo.dwNumberOfProcessors);
printf("dwProcessorType: %d\n", rSystemInfo.dwProcessorType);
printf("wProcessorRevision: %d\n", rSystemInfo.wProcessorRevision);

MessageBox(NULL,"Hello!", "My own box", MB_OK);
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd;

hwnd =CreateWindow (
"STATIC", // window class name
"Levkine", // window caption
WS_VISIBLE, // window style
0, // initial x position
0, // initial y position
300, // initial x size
200, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

MessageBox(hwnd,"Hello!", "My own box", MB_OK);
return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd;

hwnd =CreateWindow (
"STATIC", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_POPUP, // window style
0, // initial x position
0, // initial y position
300, // initial x size
200, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

MessageBox(hwnd,"Hello!", "My own box", MB_OK);
return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd;

hwnd =CreateWindow (
"EDIT", // window class name
"Levkine", // window caption
WS_VISIBLE, // window style
0, // initial x position
0, // initial y position
300, // initial x size
100, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

MessageBox(hwnd,"Pause", "My own box", MB_OK);
return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd;

hwnd =CreateWindow (
"EDIT", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_POPUP, // window style
30, // initial x position
30, // initial y position
300, // initial x size
100, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

MessageBox(hwnd,"Pause", "My own box", MB_OK);
return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd;

hwnd =CreateWindow (
"BUTTON", // window class name
"Levkine", // window caption
WS_VISIBLE, // window style
0, // initial x position
0, // initial y position
300, // initial x size
100, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

MessageBox(hwnd,"Pause", "My own box", MB_OK);
return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd;

hwnd =CreateWindow (
"SCROLLBAR", // window class name
"Levkine", // window caption
WS_VISIBLE, // window style
0, // initial x position
0, // initial y position
300, // initial x size
40, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

MessageBox(hwnd,"Pause", "My own box", MB_OK);
return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>
#include <stdio.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd;
MSG msg;
HDC hdc;

hwnd =CreateWindow (
"BUTTON", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_POPUP, // window style
100, // initial x position
20, // initial y position
100, // initial x size
100, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

//Windows application Thread has message queue
while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
//DefWindowProc(hwnd, msg.message, msg.wParam, msg.lParam);
printf("%x ", msg.message);
}
return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>
#include <stdio.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd;
MSG msg;
HDC hdc;

hwnd =CreateWindow (
"BUTTON", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_POPUP, // window style
100, // initial x position
20, // initial y position
100, // initial x size
100, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

//Windows application Thread has message queue
while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
printf("%x ", msg.message);
}
return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
MSG msg ;

wndclass.style = 0 ;
wndclass.lpfnWndProc = (WNDPROC) 0;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = NULL ;
wndclass.hCursor = NULL ;
wndclass.hbrBackground = NULL ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClassA (&wndclass) ;

hwnd =CreateWindowA (
"WinClass", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_THICKFRAME,// window style
20, // initial x position
20, // initial y position
200, // initial x size
200, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
}

return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>
#include <stdio.h>

//-------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
return DefWindowProc (hWnd, message, wParam, lParam) ;
}

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd;
MSG msg;
HDC hdc;

hwnd =CreateWindow (
"BUTTON", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_POPUP, // window style
100, // initial x position
20, // initial y position
100, // initial x size
100, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

//Windows application Thread has message queue
while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
// printf("%x ", msg.message);
}
return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//-------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
MSG msg ;

wndclass.style = 0 ;
wndclass.lpfnWndProc = (WNDPROC) WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = NULL ;
wndclass.hCursor = NULL ;
wndclass.hbrBackground = NULL ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClassA (&wndclass) ;

hwnd =CreateWindowA (
"WinClass", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_THICKFRAME,// window style
20, // initial x position
20, // initial y position
500, // initial x size
300, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
}

return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//-------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_LBUTTONDOWN:
MessageBeep(0);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
MSG msg ;

wndclass.style = 0 ;
wndclass.lpfnWndProc = (WNDPROC) WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = NULL ;
wndclass.hCursor = NULL ;
wndclass.hbrBackground = NULL ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClassA (&wndclass) ;

hwnd =CreateWindowA (
"WinClass", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_THICKFRAME,// window style
20, // initial x position
20, // initial y position
500, // initial x size
300, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
}

return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//-------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hWnd, message, wParam, lParam) ; }

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
MSG msg ;

wndclass.style = CS_GLOBALCLASS|CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC) WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = NULL ;
wndclass.hCursor = NULL ;
wndclass.hbrBackground = NULL ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClass (&wndclass) ;

hwnd =CreateWindowA (
"WinClass", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_THICKFRAME,// window style
20, // initial x position
20, // initial y position
500, // initial x size
300, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
}

return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//-------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
MSG msg ;

wndclass.style = CS_GLOBALCLASS|CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC) WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = NULL ;
wndclass.hCursor = NULL ;
wndclass.hbrBackground = NULL ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClass (&wndclass) ;

hwnd =CreateWindowA (
"WinClass", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_THICKFRAME|WS_OVERLAPPEDWINDOW,// window style
20, // initial x position
20, // initial y position
500, // initial x size
300, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
}

return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//-------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_LBUTTONDOWN:
SetWindowText(hWnd,"Test: WM_LBUTTONDOWN");
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
MSG msg ;

wndclass.style = CS_GLOBALCLASS|CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC) WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = NULL ;
wndclass.hCursor = NULL ;
wndclass.hbrBackground = NULL ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClass (&wndclass) ;

hwnd =CreateWindowA (
"WinClass", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_THICKFRAME|WS_OVERLAPPEDWINDOW,// window style
20, // initial x position
20, // initial y position
500, // initial x size
300, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
}

return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

#define DELAY 2000000000
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,UINT wParam,LONG lParam);

//---------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
unsigned long i;

if (!hPrevInst) {
wndclass.style = 0 ;
wndclass.lpfnWndProc = (WNDPROC) WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst;
wndclass.hIcon = NULL ;
wndclass.hCursor = NULL ;
wndclass.hbrBackground = NULL ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;
RegisterClass (&wndclass) ;
}
hwnd =CreateWindow
(
"WinClass", // window class name
"TestS", // window caption
0, // window style
0, // initial x position
0, // initial y position
300, // initial x size
300, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL
) ; // creation parameters

ShowWindow (hwnd, SW_SHOW) ;
for(i=0; i
MoveWindow(hwnd,100,100,200,200, 1);
for(i=0; i return 0 ;
}
//---------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,UINT wParam,LONG lParam)
{
return DefWindowProc (hwnd, message, wParam, lParam) ;
}


###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//-------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
MSG msg ;

wndclass.style = CS_GLOBALCLASS|CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC) WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = NULL ;
wndclass.hCursor = NULL ;
wndclass.hbrBackground = NULL;//(HBRUSH) GetStockObject(WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClass (&wndclass) ;

hwnd =CreateWindowA (
"WinClass", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_THICKFRAME|WS_OVERLAPPEDWINDOW,// window style
20, // initial x position
20, // initial y position
500, // initial x size
300, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
}

return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//-------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
MSG msg ;

wndclass.style = CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC) WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = NULL ;
wndclass.hCursor = LoadCursor(NULL, IDC_HAND);//NULL ;
wndclass.hbrBackground = NULL ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClass (&wndclass) ;

hwnd =CreateWindowA (
"WinClass", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_THICKFRAME|WS_OVERLAPPEDWINDOW,// window style
20, // initial x position
20, // initial y position
500, // initial x size
300, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
}

return 0;
}
###########################################################################
//==============================================================================
//
//==============================================================================
#include <windows.h>

//-------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}

//----------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCP, int nCS)
{
HWND hwnd ;
WNDCLASS wndclass ;
MSG msg ;

wndclass.style = CS_GLOBALCLASS|CS_HREDRAW|CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC) WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = LoadIcon(NULL, IDI_WARNING);
wndclass.hCursor = NULL ;
wndclass.hbrBackground = NULL;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClass (&wndclass) ;

hwnd =CreateWindowA (
"WinClass", // window class name
"Levkine", // window caption
WS_VISIBLE|WS_THICKFRAME|WS_OVERLAPPEDWINDOW,// window style
20, // initial x position
20, // initial y position
500, // initial x size
300, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters

while (GetMessage (&msg, NULL, 0, 0))
{
DispatchMessage(&msg);
}

return 0;
}
###########################################################################
#include <windows.h>
//----------------------------------------------------------------------------
LRESULT CALLBACK WndProc (HWND hWnd, UINT message, UINT wParam, LONG lParam);
int MsgLoop(void);
HWND CreateMainWin(char *);

HINSTANCE hInst, hPrevInst;

//----------------------------------------------------------------------------
HWND CreateMainWin(char * str)
{
HWND hwnd ;
WNDCLASS wndclass ;

wndclass.style = CS_HREDRAW|CS_VREDRAW ;
wndclass.lpfnWndProc = (WNDPROC) WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInst ;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW) ;
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = "WinClass" ;

RegisterClass(&wndclass) ;

hwnd = CreateWindowA(
"WinClass", // window class name
str, // window caption
WS_OVERLAPPEDWINDOW|WS_VISIBLE,// window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInst, // program instance handle
NULL) ; // creation parameters
return hwnd;
}

//----------------------------------------------------------------------------
int MsgLoop(void)
{
MSG msg;
while (GetMessage (&msg, NULL, 0, 0))
{
//TranslateMessage(&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
###########################################################################
// gcc generic.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc textout.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
HDC hdc;
switch(message)
{
case WM_LBUTTONDOWN:
hdc=GetDC(hWnd);
TextOut(hdc,50,50,"HELLO Win",9);
ReleaseDC(hWnd,hdc);
return(0);
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin("generic");
return MsgLoop();
}
###########################################################################
// gcc printtable.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
HDC hdc;
int i;
char s[100];

switch(message)
{
case WM_LBUTTONDOWN:
hdc=GetDC(hWnd);
for(i=0; i<30; i++)
{
wsprintf(s, "%2d %5d", i, i*i);
TextOut(hdc, 0, i*15, s, lstrlen(s) );
}
ReleaseDC(hWnd,hdc);
return(0);
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin("generic");
return MsgLoop();
}
###########################################################################
// gcc settextclolor.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
HDC hdc;
int i;
char s[100];

switch(message)
{
case WM_LBUTTONDOWN:
hdc=GetDC(hWnd);
TextOut(hdc,50,50,"HELLO",5);
SetTextColor(hdc,0x000000ff);
TextOut(hdc,50,70,"HELLO",5);
SetTextColor(hdc,0x0000ff00);
TextOut(hdc,50,90,"HELLO",5);
ReleaseDC(hWnd,hdc);
return(0);
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin("generic");
return MsgLoop();
}
###########################################################################
// gcc generic.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
HDC hdc;
int j,k;
switch(message)
{
case WM_LBUTTONDOWN:
hdc=GetDC(hWnd);
for(k=0; k<200; k++)
for(j=0; j<200; j++)
{
SetPixel(hdc,k,j,0x00ff);
}
ReleaseDC(hWnd,hdc);
return(0);
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin("generic");
return MsgLoop();
}
###########################################################################
// gcc movetolineto.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
HDC hdc;
int x, y;
switch(message)
{
case WM_MOUSEMOVE:
x=LOWORD(lParam); y=HIWORD(lParam);
hdc=GetDC(hWnd);
MoveToEx(hdc,x-5,y-5, NULL); LineTo(hdc,x+5,y+5);
MoveToEx(hdc,x-5,y+5, NULL); LineTo(hdc,x+5,y-5);
ReleaseDC(hWnd,hdc);
return(0);
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc movetolineto.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
HDC hdc;
int x, y;
int i;
switch(message)
{
case WM_LBUTTONDOWN:
x=LOWORD(lParam); y=HIWORD(lParam);
hdc=GetDC(hWnd);
for(i=20; i>0; i-=4) Rectangle(hdc, x-i,y-i, x+i,y+i);
ReleaseDC(hWnd,hdc);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc movetolineto.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
HDC hdc;
int x, y;
int i;
switch(message)
{
case WM_LBUTTONDOWN:
x=LOWORD(lParam); y=HIWORD(lParam);
hdc=GetDC(hWnd);
for(i=50; i>0; i-=10) Ellipse(hdc, x-i,y-i, x+i,y+i);
ReleaseDC(hWnd,hdc);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc generic.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
char buf[100];
HDC hdc;
PAINTSTRUCT ps;
switch(message)
{
case WM_PAINT:
hdc=BeginPaint(hWnd,&ps);
MessageBeep(0);
wsprintf(buf,"%1d %4d %4d %4d %4d", ps.fErase, ps.rcPaint.left,
ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
SetWindowText(hWnd, buf);
EndPaint(hWnd,&ps);
return 0;
case WM_LBUTTONDOWN:
hdc=GetDC(hWnd);
TextOut(hdc, 0, 0, "0123456789", 10);
ReleaseDC(hWnd, hdc);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc generic.c -lgdi32
//#include <stdio.h>
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
char strbuf[257];
switch(message)
{
case WM_MOUSEMOVE:
wsprintf(strbuf, "%5d %5d %5d", wParam, LOWORD(lParam), HIWORD(lParam));
SetWindowText(hWnd, strbuf);
break;
case WM_LBUTTONDOWN:
Beep(500, 500);
break;
case WM_LBUTTONUP:
MessageBeep(1);
break;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc generic.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
char strbuf[257];
switch(message)
{
case WM_KEYDOWN:
wsprintf(strbuf, "%04x %04x %02x %02x", wParam,
LOWORD(lParam), LOBYTE(HIWORD(lParam)), HIBYTE(HIWORD(lParam)));
SetWindowText(hWnd, strbuf);
break;
case WM_KEYUP:
MessageBeep(1);
break;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc generic.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
char strbuf[257];

switch(message)
{
case WM_DESTROY:
wsprintf(strbuf,"%4x %4x %8x", message, wParam, lParam);
SetWindowText(hWnd,strbuf);
MessageBox(hWnd,strbuf,"",0);
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc generic.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_CREATE:
MessageBox(hWnd,"WM_CREATE","",0);
break;
case WM_SHOWWINDOW:
MessageBox(hWnd,"WM_SHOWWINDOW","",0);
break;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc generic.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_SYSCOMMAND:
MessageBox(hWnd, "Sys Command", "", 0);
break;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// gcc generic.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_TIMER:
if(wParam==1) Beep(500, 500);
if(wParam==2) MessageBeep(0);
break;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");

SetTimer(hwnd, 1, 1500, 0);
SetTimer(hwnd, 2, 20000, 0);

return MsgLoop();
}
###########################################################################
// gcc stringresourses.c -lgdi32 stringresourses.o
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
char buf[100];
switch(message)
{
case WM_LBUTTONDOWN:
LoadString(hInst, 1, buf, 99);
MessageBox(hWnd, buf, "Load String", 0);
return 0;
case WM_MBUTTONDOWN:
LoadString(hInst, 2, buf, 99);
MessageBox(hWnd, buf, "Load String", 0);
return 0;
case WM_RBUTTONDOWN:
LoadString(hInst, 3, buf, 99);
MessageBox(hWnd, buf, "Load String", 0);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
// compilation in mingw: windres stringresourses.rc stringresourses.o
// every string have integer ID
STRINGTABLE
BEGIN
1, "AAAAAAAAAA" //1= ID of string
2, "BBBBBBBBBB" //2= ID of string
3, "CCCCCCCCCC" //3= ID of string
END
###########################################################################
// gcc movetolineto.c -lgdi32
#include "generic.h"
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
HDC hdc;
int x, y;
int i;
switch(message)
{
case WM_LBUTTONDOWN:
x=LOWORD(lParam); y=HIWORD(lParam);
hdc=GetDC(hWnd);
for(i=50; i>0; i-=10) Ellipse(hdc, x-i,y-i, x+i,y+i);
ReleaseDC(hWnd,hdc);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
HMENU hmenu;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
hmenu=CreateMenu();
AppendMenu(hmenu, MF_STRING, 300, "&File");
SetMenu(hwnd,hmenu);

ShowWindow (hwnd, SW_SHOW) ; return MsgLoop();
}
###########################################################################
// gcc generic.c -lgdi32
#include "generic.h"
#define IDM_FILE 100
//-----------------------------------------------------------------------------------
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_COMMAND:
if(wParam==IDM_FILE) MessageBeep(0);
break;
case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
HMENU hmenu;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");

hmenu=CreateMenu();
AppendMenu(hmenu, MF_STRING, IDM_FILE, "&File");
SetMenu(hwnd,hmenu);
ShowWindow (hwnd, SW_SHOW) ;

return MsgLoop();
}
###########################################################################
#include <windows.h>
long FAR PASCAL _export WndProc (HWND, UINT, UINT, LONG) ;
//----------------------------------------------------------------------------
int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInst, LPSTR lpszCP, int nCSh)
{HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;

if (!hPrevInst) { wndclass.style = NULL ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = NULL ;
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW) ;
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH) ;
wndclass.lpszMenuName = "SimpleMenu" ;
wndclass.lpszClassName = "WinClass" ;
RegisterClass (&wndclass) ; };

hwnd =CreateWindow("WinClass", // window class name
"HENRY", // window caption
WS_THICKFRAME|WS_VISIBLE, // window style
0, 0, // initial x, y position
500,300, // initial x, y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL) ; // creation parameters
while (GetMessage (&msg, NULL, 0, 0)) { DispatchMessage (&msg) ; }
return msg.wParam ;
}
//----------------------------------------------------------------------------
long FAR PASCAL _export WndProc(HWND hwnd,UINT message,UINT wParam,LONG lParam)
{
switch(message)
{
case WM_COMMAND:
switch(wParam)
{
case 100:
MessageBox(hwnd,"New", "Menu", NULL);
break;
case 101:
PostQuitMessage(0);
break;
case 200:
MessageBox(hwnd,"Help", "Menu", NULL);
break;
};
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc (hwnd, message, wParam, lParam) ; }
###########################################################################
// compilation in mingw: windres menu.rc menurc.o
#define IDM_NEW 101
#define IDM_EXIT 102
#define IDM_HELP 150
SimpleMenu MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New", 101
MENUITEM SEPARATOR
MENUITEM "&Exit", 102
END
MENUITEM "&Help", 150
END
###########################################################################
// gcc bmpdisp.c -lgdi32 bmpdispres.o
#include "generic.h"
//-----------------------------------------------------------------------------------
#define IDB_BABOON 500
HBITMAP g_hbm = NULL;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
switch(message)
{
case WM_CREATE:
g_hbm = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BABOON));
if(g_hbm == NULL)
MessageBox(hWnd, "Could not load IDB_BALL!", "Error", MB_OK | MB_ICONEXCLAMATION);
break;
case WM_PAINT:
{
BITMAP bm;
PAINTSTRUCT ps;

HDC hdc = BeginPaint(hWnd, &ps);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = SelectObject(hdcMem, g_hbm);
GetObject(g_hbm, sizeof(bm), &bm);
BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
EndPaint(hWnd, &ps);
}
break;

case WM_DESTROY:
PostQuitMessage(0);
return(0);
}
return DefWindowProc (hWnd, message, wParam, lParam) ;
}
//------------------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstan, LPSTR lpszCP, int nCSh)
{
HWND hwnd ;
hInst = hInstance;
hPrevInst = hPrevInstan;
hwnd = CreateMainWin( (char *)"generic");
return MsgLoop();
}
###########################################################################
#define IDB_BABOON 500
IDB_BABOON BITMAP baboon.bmp