1#include <windows.h>2 3LRESULT CALLBACK Mywndproc (HWND hwnd,//Handle to Window4UINT umsg,//message identifier5WPARAM WPARAM,//First message parameter6LPARAM LPARAM//Second message parameter7 );8 9 intWINAPI WinMain (hinstance hinstance, hinstance hprevinstance, LPSTR lpCmdLine,intnshowcmd)Ten { One wndclass wnd; A HWND hwnd; - msg msg; -Wnd.style = Cs_hredraw | Cs_vredraw;//The horizontal or vertical change window is redrawn with Mywndproc's WM_PAINT message Association theWnd.lpfnwndproc =Mywndproc; -Wnd.cbclsextra =0; -Wnd.cbwndextra =0; -Wnd.hicon =LoadIcon (NULL, idi_application); +Wnd.hcursor =loadcursor (NULL, idc_arrow); -Wnd.hbrbackground =(Hbrush) getstockobject (White_brush); +Wnd.lpszmenuname =NULL; AWnd.lpszclassname ="Helloclass";//window class identifier, used in the first parameter of CreateWindow atWnd.hinstance =hinstance; - if(! RegisterClass (&wnd)) - { -MessageBox (NULL, TEXT ("Unable to create window"), TEXT ("ERROR"), mb_ok|mb_iconerror); - return 0; - } in -hwnd = CreateWindow ("Helloclass", TEXT ("Hello"), Ws_overlappedwindow, Cw_usedefault, Cw_usedefault, Cw_usedefault, cw_usedefault, NULL, NULL, HINSTANCE, NULL);//The second argument is a window caption to ShowWindow (hwnd, nshowcmd); + while(GetMessage (&msg, NULL,0,0)) - { theTranslateMessage (&msg); *DispatchMessage (&msg); $ }Panax Notoginseng return 0; - } the + LRESULT CALLBACK Mywndproc (HWND hwnd, UINT umsg, WPARAM WPARAM, LPARAM LPARAM) A { theHDC hdc;//defining a device environment handle +Paintstruct PS;//Drawing Structures -Rect rect;//Rectangular Structure $ Switch(umsg) $ { - CaseWM_PAINT: - { theHDC = BeginPaint (hwnd, &PS); -GetClientRect (hwnd, &rect);WuyiDrawText (HDC, TEXT ("hello,world!"), -1, &rect, dt_singleline| dt_center|dt_vcenter); theEndPaint (hwnd, &PS); - } Wu Break; - CaseWm_destroy: AboutPostQuitMessage (0); $ return 0; - } - - returnDefWindowProc (hwnd, umsg, WParam, LParam); A}