728x90
반응형
1. 코드
#include<windows.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
HINSTANCE g_Inst;
LPCWSTR lpszClass = TEXT("Window");
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszClassParam, int nCmdShow)
{
HWND hWnd;
MSG Message;
WNDCLASS WndClass;
g_Inst = hInstance;
WndClass.cbClsExtra=0;
WndClass.cbWndExtra=0;
WndClass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
WndClass.hCursor=LoadCursor(NULL, IDC_ARROW);
WndClass.hIcon=LoadIcon(NULL, IDI_APPLICATION);
WndClass.hInstance=hInstance;
WndClass.lpfnWndProc=WndProc;
WndClass.lpszClassName=lpszClass;
WndClass.lpszMenuName=NULL;
WndClass.style=CS_HREDRAW|CS_VREDRAW;
RegisterClass(&WndClass);
hWnd=CreateWindow(lpszClass, lpszClass, WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT
, NULL, (HMENU)NULL, hInstance, NULL);
ShowWindow(hWnd,nCmdShow);
while(GetMessage(&Message, NULL, 0, 0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return (int)Message.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
switch(iMessage)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, iMessage, wParam,lParam);
}
728x90
반응형
'프로그래밍 > Windows' 카테고리의 다른 글
[Windows] 윈도우 버전 확인 (Win32API) (1) | 2015.08.23 |
---|---|
[Windows] 프로세스/운영체제 비트 확인 (Win32API) (0) | 2015.08.23 |
[Windows] 프로세스 정보 확인하기 (Win32API) (0) | 2015.08.23 |
[Windows] 파일열기 대화상자 (Win32API) (0) | 2015.08.22 |
[Windows] 관리자 권한 요구하기 (Win32API) (0) | 2015.08.22 |
[Windows] ATL90.dll, MSVCR90.dll 의존성 제거 (Win32API) (0) | 2015.08.21 |
댓글