일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 그래픽스기초
- win32
- 그래픽스
- MFC
- OpenGL
- denoising
- window programming
- 윈도우 구조
- Win32 API
- 윈도우
- Mesh Processing
- 베지에 곡선
- MFC 윈도우 프로그래밍
- 윈도우프로그래밍
- modeling
- Graphics
- 오픈지엘
- 컴퓨터 아키텍쳐
- Geometry Modeling
- 컴퓨터 구조
- 셰이더
- 핵심 API로 배우는 윈도우프로그래밍
- bezier curve
- 렌더링
- c4d
- 윈도우 프로그래밍
- 셰이더프로그래밍
- shader
- 운영체제
- shader programming
Archives
- Today
- Total
오다기리 박의 알고리즘 노트
[핵심 API로 배우는 윈도우프로그래밍(강경우, 한빛아카데미)] 7장 7번 풀이 본문
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | #include <Windows.h> #include<tchar.h> #include<string.h> #include<math.h> //#include"resource.h" //#pragma comment(linker,"/entry:WinMainCRTStartup /subsystem:console") LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam); HINSTANCE hInst; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { HWND hwnd; MSG msg; WNDCLASS WndClass; hInst = hInstance; 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 = _T("Window Class Name"); RegisterClass(&WndClass); hwnd = CreateWindow( _T("Window Class Name"), _T("박정호"), WS_OVERLAPPEDWINDOW, 50, 50, 1000, 700, NULL, NULL, hInstance, NULL); ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int)msg.wParam; } #define IDC_COMBO1 100 #define IDC_COMBO2 101 #define IDC_COMBO3 102 #define IDC_EDIT1 103 #define IDC_EDIT2 104 #define IDC_BUTTON 105 LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; TCHAR str[20], editstr[20], tmp1[20], tmp2[20], tmp3[20]; static HWND hCombo1, hCombo2, hCombo3, hEdit1, hEdit2,hEnrollButton; switch (iMsg) { case WM_CREATE: hCombo1 = (HWND)CreateWindow(_T("combobox"), NULL, WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | CBS_NOINTEGRALHEIGHT, 100, 100, 100, 400, hwnd, (HMENU)IDC_COMBO1, hInst, NULL); hCombo2 = (HWND)CreateWindow(_T("combobox"), NULL, WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | CBS_NOINTEGRALHEIGHT, 200, 100, 100, 300, hwnd, (HMENU)IDC_COMBO2, hInst, NULL); hCombo3 = (HWND)CreateWindow(_T("combobox"), NULL, WS_CHILD | WS_VISIBLE | CBS_DROPDOWN | CBS_NOINTEGRALHEIGHT, 300, 100, 100, 600, hwnd, (HMENU)IDC_COMBO3, hInst, NULL); hEdit1 = (HWND)CreateWindow(_T("edit"), NULL, WS_CHILD | WS_VISIBLE | ES_READONLY | WS_BORDER, 130, 200, 100, 20, hwnd, (HMENU)IDC_EDIT1, hInst, NULL); hEdit2 = (HWND)CreateWindow(_T("edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, 270, 200, 100, 20, hwnd, (HMENU)IDC_EDIT2, hInst, NULL); hEnrollButton = (HWND)CreateWindow(_T("button"), _T("주민번호입력"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 400, 100, 120, 20, hwnd, (HMENU)IDC_BUTTON, hInst, NULL); for (int i = 0; i < 20; i++) { _stprintf_s(str, 20, _T("%d"), 1980 + i); SendMessage(hCombo1, CB_ADDSTRING, 0, (LPARAM)str); } for (int i = 1; i <= 12; i++) { _stprintf_s(str, 20, _T("%d월"), i); SendMessage(hCombo2, CB_ADDSTRING, 0, (LPARAM)str); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_COMBO2: switch (1 + SendMessage(hCombo2, CB_GETCURSEL, 0, 0)) { case 1: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 31; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 2: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 28; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 3: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 31; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 4: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 30; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 5: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 31; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 6: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 30; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 7: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 31; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 8: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 31; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 9: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 30; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 10: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 31; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 11: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 30; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; case 12: SendMessage(hCombo3, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= 31; i++) { _stprintf_s(str, 20, _T("%d"), i); SendMessage(hCombo3, CB_ADDSTRING, 0, (LPARAM)str); } break; } break; case IDC_BUTTON: SetDlgItemText(hwnd, IDC_EDIT1, _T("")); editstr[0] = '\0'; GetDlgItemText(hwnd, IDC_COMBO1, tmp1, 20); GetDlgItemText(hwnd, IDC_COMBO2, tmp2, 20); GetDlgItemText(hwnd, IDC_COMBO3, tmp3, 20); editstr[0] = tmp1[2]; editstr[1] = tmp1[3]; if (_tcslen(tmp2) == 2) { editstr[2] = '0'; editstr[3] = tmp2[0]; } else { editstr[2] = tmp2[0]; editstr[3] = tmp2[1]; } if (_tcslen(tmp3) == 1) { editstr[4] = '0'; editstr[5] = tmp3[0]; } else { editstr[4] = tmp3[0]; editstr[5] = tmp3[1]; } editstr[6] = '\0'; SetDlgItemText(hwnd, IDC_EDIT1, editstr); break; } break; case WM_PAINT: hdc = BeginPaint(hwnd, &ps); TextOut(hdc, 120, 70, _T("연도선택"), _tcsclen(_T("연도선택"))); TextOut(hdc, 220, 70, _T("월 선택"), _tcsclen(_T("월 선택"))); TextOut(hdc, 320, 70, _T("일 선택"), _tcsclen(_T("일 선택"))); TextOut(hdc, 130, 170, _T("주민번호 앞자리 - 주민번호 뒷자리"), _tcsclen(_T("주민번호 앞자리 - 주민번호 뒷자리"))); EndPaint(hwnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hwnd, iMsg, wParam, lParam); } | cs |
'WIN32 API' 카테고리의 다른 글
[핵심 API로 배우는 윈도우프로그래밍(강경우, 한빛아카데미)] 7장 9번 풀이 (0) | 2017.11.03 |
---|---|
[핵심 API로 배우는 윈도우프로그래밍(강경우, 한빛아카데미)] 7장 8번 풀이 (0) | 2017.11.03 |
[핵심 API로 배우는 윈도우프로그래밍(강경우, 한빛아카데미)] 7장 6번 풀이 (0) | 2017.11.03 |
[핵심 API로 배우는 윈도우프로그래밍(강경우, 한빛아카데미)] 7장 5번 풀이 (0) | 2017.11.03 |
[핵심 API로 배우는 윈도우프로그래밍(강경우, 한빛아카데미)] 7장 4번 풀이 (0) | 2017.11.03 |