LRESULT 콜백 WndProc(HWND, UINT, WPARAM, lparam);
Intwinapi winmain (h instance h instance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
정적 tchar szappnume [] = text ("hello win");
HWND hWnd
조미료
WNDCLASS wndclass
Wndclass.style = cs _ h redraw | cs _ v redraw;
Wndclass.lpfnWndProc = WndProc
Wndclass.cbclsextra = 0;
Wndclass.cbwndextra = 0;
Wndclass.h instance = h instance;
Wndclass.hIcon = LoadIcon(NULL, IDI _ apply);
Wndclass.h cursor = load cursor (null, IDC _ arrow);
Wndclass.hbrbackground = (hbrush) getstockobject (white _ brush);
Wndclass.lpszMenuName = NULL
Wndclass.lpsz classname = szappnume;
만약 (! Registerclass (& Wndclass))
{
MessageBox(NULL, TEXT ("이 프로그램에는 Windows NT!" " ), szAppNume, MB _ iconerror);
0 을 반환합니다
}
HWnd = CreateWindow(szAppNume,//창 클래스 이름
TEXT(" Hello 프로그램 "),//창 제목
WS_OVERLAPPEDWINDOW,//창 스타일
CW_USEDEFAULT,//초기 x 위치
CW_USEDEFAULT,//초기 y 위치
CW_USEDEFAULT,//초기 x 크기
CW_USEDEFAULT,//초기 y 치수
NULL,//부모 창 핸들
NULL,//창 메뉴 핸들
HInstance,//프로그램 인스턴스 핸들
Null); //생성 매개 변수
쇼 창 (hwnd, icmd 쇼);
업데이트 창 (hwnd);
While (getmessage (& Msg, NULL, 0, 0))
{
번역 메시지 (& msg);
Dispatch message(amp;; MSG);
}
Msg.wParam 을 반환합니다
}
LRESULT 콜백 WndProc(HWND hWnd, UINT 메시지, WPARAM wParam, LPARAM lParam)
{
HDC hdc
PAINTSTRUCT PS
RECT 직사각형;
스위치 (메시지)
{
시나리오 WM_CREATE:
깨뜨리다
시나리오 WM_PAINT:
Hdc = beginpaint (hwnd & Ps);
GetClientRect(hWnd & amp;; Rect);
DrawText(hdc, Text) ("안녕하세요, Windows 2000!" " ),-1, & amprect,
Dt _ single line | dt _ center | dt _ vcenter);
탑 코트 (hWnd & amp;; Ps);
0 을 반환합니다
시나리오 WM_DESTROY:
Postquitmessage (0) :
0 을 반환합니다
}
DefWindowProc(hWnd, message, wParam, lparam) 를 반환합니다.
}