1.must has an entrypoint: WinMain
2.must harve a function to solid message loop.
//sothing.c
#include
INT Pascal Winmain (Hinstance, Hinstance, LPSTR, INT);
Lresult Callback WndProc (HWND, UINT, WPARAM, LPARAM);
Hinstance hinst;
CHAR SZAPPNAME [] = "....";
Char szapptitle [] = "...";
INT Pascal Winmain (Hinstance Hinstance, Hinstance Hpreinstance, LPSTR LPSZCMDPARAM, INT NCMDSHOW)
{
Hwnd hwnd;
MSG Message;
WNDCLASS WC;
IF (! hpreinstance)
{
wc.style = ......
Wc.lpfnwndproc = WndProc;
RegisterClass (& WC);
}
HWND = CREATEWINDOW
.....
);
Showwindow (hwnd, ....);
UpdateWindow (HWND);
While (GetMessage (& Message, NULL, 0, 0))
{
TranslateMessage (& Message);
DispatchMessage (& Message);
}
Return Message.wParam;
}
LResult Callback WndProc (HWND HWNDMAIN,
Unit Message,
WPARAM WPARAM,
LParam LPARAM)
{
...
Switch (Message)
{
Case WM_DESTROY:
....
}
Return DefWindowProc (HWndmain, Message, WParam, Lparam);
}