#include<windows.h>
LRESULT CALLBACK WndProc( HWND hwnd ,
UINT message ,
WPARAM wParam ,
LPARAM lParam ) ;
int WINAPI WinMain( HINSTANCE hInstance ,
HINSTANCE hPrevInstance ,
LPTSTR lpszCmdLine ,
int nCmdShow)
{
static char szAppName[] = "윈도우 클래스 이름";
static char szTitleName[] = "타이틀바에 출력 내용" ;
WNDCLASS WndClass ;
HWND hwnd;
MSG msg;
/*윈도우 클래스 구조체 생성*/
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;
RegisterClass(&WndClass);
/*프레임 윈도우 생성*/
hwnd = CreateWindow(szAppName,
szTitleName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
/*표시*/
ShowWindow(hwnd,nCmdShow);
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 lParam )
{
switch(message)
{
case WM_CREATE:
return 0;
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint(hwnd , &ps);
EndPaint(hwnd , &ps);
}
return 0;
case WM_DESTROY:
{
PostQuitMessage(0);
}
return 0;
}
return DefWindowProc(hwnd , message , wParam , lParam);
}