#include <windows.h>
Lresult CALLBACK WndProc (Hwnd,uint,wparam,lparam);
int WINAPI WinMain (hinstance hinstance,hinstance hprevinstance,pstr szcmdline,int)
{
Static TCHAR Szappname[]=text ("Hellowin");
HWND hwnd;
MSG msg;
Wndclass Wndclass;
Wndclass.style =cs_hredraw|cs_vredraw;
Wndclass.lpfnwndproc =wndproc;
Wndclass.cbclsextra = 0;
Wndclass.cbwndextra = 0;
Wndclass.hinstance =hinstance;
Wndclass.hicon =loadicon (null,idi_application);
Wndclass.hcursor =loadcursor (Null,idc_arrow);
Wndclass.hbrbackground = (hbrush) getstockobject (White_brush);
Wndclass.lpszmenuname =null;
Wndclass.lpszclassname =szappname;
if (! RegisterClass (&wndclass))
{
MessageBox (Null,text ("This program requires Windows nt!"), Szappname,mb_iconerror);
return 0;
}
Hwnd=createwindow (Szappname,text ("The Hello Program"), Ws_overlappedwindow,cw_usedefault,
Cw_usedefault,cw_usedefault,cw_usedefault,null,null,hinstance,null);
ShowWindow (hwnd,icmdshow);
UpdateWindow (HWND);
while (GetMessage (&msg,null,0,0))
{
TranslateMessage (&MSG);
DispatchMessage (&MSG);
}
return msg.wparam;
}
Lresult CALLBACK WndProc (HWND hwnd,uint message,wparam Wparam,lparam)
{
HDC HDC;
Paintstruct PS;
RECT RECT;
Switch (message)
{
Case WM_CREATE:
PlaySound (TEXT ("Hellowin.wav"), null,snd_filename| Snd_async);
return 0;
Case WM_PAINT:
Hdc=beginpaint (HWND,&PS);
GetClientRect (Hwnd,&rect);
DrawText (Hdc,text ("HELLO world!"), -1,&rect,
dt_singleline| dt_center| Dt_vcenter);
EndPaint (HWND,&PS);
return 0;
Case Wm_destroy:
PostQuitMessage (0);
return 0;
}
return DefWindowProc (Hwnd,message,wparam,lparam);
}