À©µµ¿ìÁî APIÁ¤º¹ 1±Ç 194ÆäÀÌÁö Áú¹®ÀÔ´Ï´Ù. ÇöÀç ºñÁÖ¾ó½ºÆ©µð¿À 2022»ç¿ë ÁßÀ̸ç, 64ºñÆ® µð¹ö±×·Î ÁøÇàÇϰí ÀÖ½À´Ï´Ù.
194ÆäÀÌÁö BUTTON»ý¼º°ú °ü·Ã ¿¹Á¦°¡ ÀÛµ¿ÀÌ ¾È µË´Ï´Ù. Ȥ½Ã ¾Æ·¡ Äڵ忡 ¹®Á¦°¡ ÀÖ´ÂÁö¿ä? ´äº¯ ºÎʵ右´Ï´Ù.
-------------------------------------------------------------------------------------------------------------------------------------------
#include<Windows.h>
LPCTSTR my_class_name = TEXT("Button");
HINSTANCE g_hinst;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lnCmdLine, _In_ int nCmdShow) {
HWND hWnd;
MSG msg;
WNDCLASS wndclass;
g_hinst = hInstance;
wndclass.lpfnWndProc = WndProc;
wndclass.lpszClassName = my_class_name;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wndclass.hInstance = hInstance;
wndclass.lpszMenuName = NULL;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndclass);
hWnd = CreateWindow(my_class_name, my_class_name, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, (HMENU)NULL, hInstance, NULL);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return((int)msg.wParam);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) {
switch (iMessage) {
case WM_CREATE:
CreateWindow(TEXT("button"), TEXT("Click Me"), WS_CHILD | WS_VISIBLE |
BS_PUSHBUTTON, 20, 20, 100, 25, hWnd, (HMENU)0, g_hinst, NULL);
CreateWindow(TEXT("button"), TEXT("Me Two"), WS_CHILD | WS_VISIBLE |
BS_PUSHBUTTON, 20, 50, 100, 25, hWnd, (HMENU)1, g_hinst, NULL);
return 0;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case 0:
MessageBox(hWnd, TEXT("First Button Clicked"), TEXT("Button"), MB_OK);
break;
case 1:
MessageBox(hWnd, TEXT("Second Button Clicked"), TEXT("Button"), MB_OK);
break;
}
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return(DefWindowProc(hWnd, iMessage, wParam, lParam));
}

±è¹Î¼ö
|
|