728x90
Visual Studio 2017 에서 작성한 기본 WinApi 코드 입니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#include <Windows.h>
HINSTANCE g_hInstance;
HWND g_hWnd;
LPSTR g_lpszClass = (LPSTR)TEXT("윈메인의 시작");
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE _hInstance, HINSTANCE _hPrevInstance,
LPSTR _lpszCmdParam, int nCmdShow)
{
g_hInstance = _hInstance;
WNDCLASS wndClass;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndClass.hInstance = _hInstance;
wndClass.lpfnWndProc = WndProc;
wndClass.lpszClassName = g_lpszClass;
wndClass.lpszMenuName = NULL;
wndClass.style = CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndClass);
g_hWnd = CreateWindow(g_lpszClass,
g_lpszClass,
WS_OVERLAPPEDWINDOW,
50, 50,
600, 450,
NULL, NULL,
_hInstance, NULL);
ShowWindow(g_hWnd, nCmdShow);
MSG message;
while (GetMessage(&message, 0, 0, 0))
{
TranslateMessage(&message);
DispatchMessage(&message);
}
return message.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage,
WPARAM wParam, LPARAM lParam)
{
switch (iMessage)
{
case WM_CREATE:
break;
/*case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
break;*/
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, iMessage, wParam, lParam);
}
|
cs |
728x90
'Archive' 카테고리의 다른 글
프로그래머스 - 수포자 (0) | 2019.12.10 |
---|---|
Day 3~4 (0) | 2019.11.28 |
Day 2 (0) | 2019.11.26 |
Day 1 (0) | 2019.11.26 |
A* Algorithm 구현 (0) | 2019.11.25 |