//模块:ApiDemo.c
#include <windows.h>//int PASCAL WinMain(HINSTANCE,HINSTANCE,LPSTR,INT);
LRESULT CALLBACK WinProc(HWND,UINT,WPARAM,LPARAM);//HINSTANCE myinstance;
char appname[]="apidemo",apptitle[]="test";
int PASCAL WinMain(HINSTANCE hInstance,HINSTANCE hPreInstance,LPSTR lpszCmdParam,int nCmdShow)
{
HWND MainWnd;
MSG message;
WNDCLASSEX myWC;
if (hPreInstance)
{
myWC.cbSize = sizeof(myWC);
myWC.style = CS_HREDRAW | CS_VREDRAW;
myWC.lpfnWndProc = WinProc ;
myWC.cbClsExtra =0;
myWC.cbWndExtra = 0;
myWC.hInstance = hInstance;
myWC.hIcon = LoadIcon(NULL,IDI_APPLICATION);
myWC.hCursor = LoadCursor(NULL,IDC_ARROW);
myWC.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
myWC.lpszMenuName = NULL;
        myWC.lpszClassName = appname; if (!RegisterClassEx(&myWC))
{
  MessageBeep(0);
  return 0;
};
}
MainWnd = CreateWindow
(
appname, apptitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL
);
ShowWindow(MainWnd,SW_SHOWMAXIMIZED);
UpdateWindow(MainWnd); while (GetMessage(&message, NULL, 0, 0))
{
TranslateMessage(&message);
DispatchMessage(&message);
}
return message.wParam;
}
LRESULT CALLBACK WinProc(HWND MainWnd,UINT message,WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_RBUTTONDOWN:
{
MessageBox(GetFocus(), "rrrrrrr", "message", MB_OK);
break;
}
case WM_LBUTTONDOWN:
{
MessageBox(GetFocus(), "LLLLLLLLL", "message", MB_OK);
break;
}
case WM_DESTROY:
{
MessageBox(GetFocus(), "END", "message", MB_OK);
PostQuitMessage(0);
return 0;
}
default: break;
}
    return DefWindowProc(MainWnd, message, wParam, lParam);
}