본문 바로가기
#99.?!?!

윈도우 프로그래밍

by 일사만루병살 2011. 7. 5.

#include <windows.h>

LRESULT FAR PASCAL WndProc (HWND, UINT, UINT, LONG);

INT PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)

{

static char szAppname[]="Hello Win";

MSG                msg;

HWND             hwnd;

WNDCLASS        wndclass;

}

 

if(!hPrevInstance)

{

wndclass.style          //윈도우를 어떤 형식으로 만들지 정하는것.

wndclass.lpfnWndProc

wndclass.cbClsExtra

wndclass.cbWndExtra

wndclass.hInstance

wndclass.hIcon

wndclass.hCursor

wndclass.hbrBackground

wndclass.lpszMenuName

wndclass.lpszclassName

}

hwnd = CreatWindow(szAppname, "Hello Win demo",

                                WS_OVERLAPPEDWINDOW,

                                CW_USEDEFAULT, CW_USEDEFAULT,

                                CW_USEDEFAULT, CW_USEDEFAULT,

                                NULL, NULL, hInstance, NULL);         //윈도우를 만듬

ShowWindow(hwnd, nCmdShow);

UpdateWindows(hwnd);

while(GetMessage(&msg, NULL, 0, 0)      //메세지를 받는 부분

{

           TranslateMessage(&msg);

           DispatchMessage(&msg);

}

return msg.wParam;

}

 

LRESULT FAR PASCAL WndProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)

{

           HDC     hdc;

           PAINTSTRUCT ps;

           RECT rect;

          

           switch(message)

           {

                     case WM_PAINT;

                                hdc=BeginPaint(hwnd, &ps);

                                GetClientRect(hwnd, &rect);

                                DrawText(hdc,"Hello, Windows!",-1 &rect,                                                                DT_SINGLELINE|DT_CENTER|DT_VCENTER);

                                EndPaint(hwnd,&ps);

                                return 0;

                     case WM_DESTORY:

                                PosQuitMessage(0);

                                return 0;

                     }

                     return DefWindowProc (hwnd, message, wParam, lParam);

           }

}

'#99.?!?!' 카테고리의 다른 글

기독교 분화  (0) 2011.11.21
마인드맵 예제  (0) 2011.06.12