반응형
<취미와 성별정보를 입력받는 다이얼로그>
더보기
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 #include <windows.h>#include <tchar.h>#include "resource.h"BOOL CALLBACK DlgProc(HWND hwnd,UINT iMsg, WPARAM wParam, LPARAM lParam);int WINAPI _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow){DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG3), NULL, DlgProc);return 0;}BOOL CALLBACK DlgProc(HWND hwnd,UINT iMsg, WPARAM wParam, LPARAM lParam){TCHAR word[100];switch (iMsg){case WM_INITDIALOG:return 1;case WM_COMMAND:switch (LOWORD(wParam)){case ID_BUTTON_COPY:GetDlgItemText(hwnd, IDD_EDIT_SOURCE, word, 100);SetDlgItemText(hwnd, IDC_EDIT_COPY, word);break;case ID_BUTTON_CLEAR:SetDlgItemText(hwnd, IDD_EDIT_SOURCE, _T(""));SetDlgItemText(hwnd, IDC_EDIT_COPY, _T(""));break;case ID_BUTTON_END:EndDialog(hwnd, 0);break;case IDCANCEL:EndDialog(hwnd, 0);break;}break;}return 0;}cs
<콤보 박스 컨트롤로 회원 명단 관리하기>
더보기
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 #include <windows.h>#include <tchar.h>#include "resource.h"BOOL CALLBACKDlgProc(HWND hwnd,UINT iMsg, WPARAM wParam,LPARAM lParam);LRESULT CALLBACKWndProc(HWND hwnd,UINT iMsg, WPARAM wParam,LPARAM lParam);HINSTANCE hInst;int WINAPI _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow){DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc);return 0;}LRESULT CALLBACKWndProc(HWND hwnd,UINT iMsg, WPARAM wParam,LPARAM lParam){switch (iMsg){case WM_LBUTTONDOWN://다이얼로그박스를 띄우게DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1),hwnd, DlgProc);break;case WM_CREATE:break;//x버튼을 누르는 순간 발생case WM_DESTROY://WM_QUIT보냄PostQuitMessage(0);break;}return DefWindowProc(hwnd,iMsg, wParam, lParam);}BOOL CALLBACKDlgProc(HWND hDlg,UINT iMsg, WPARAM wParam,LPARAM lParam){static HWND hCombo;static int selection;TCHAR name[20];switch (iMsg){case WM_INITDIALOG:hCombo = GetDlgItem(hDlg, IDC_COMBO_LIST);return 1;case WM_COMMAND:switch (LOWORD(wParam)){case IDC_BUTTON_INSERT:GetDlgItemText(hDlg, IDC_EDIT_NAME, name, 20);if ( _tcscmp(name, _T("")) )SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)name);return 0;case IDC_BUTTON_DELETE:SendMessage(hCombo, CB_DELETESTRING, selection, 0);return 0;case IDC_COMBO_LIST:if (HIWORD(wParam) == CBN_SELCHANGE)selection = SendMessage(hCombo, CB_GETCURSEL, 0, 0);break;case IDCLOSE:EndDialog(hDlg, 0);return 0;case IDCANCEL: //x버튼이 발생시킴EndDialog(hDlg, 0);break;}break;}return 0;}cs
반응형
'프로그래밍 > 시스템' 카테고리의 다른 글
[java-OracleDB] DB 우편번호 검색 로직 (0) | 2017.05.25 |
---|---|
[윈도우 프로그래밍] 스레드(thread) (0) | 2017.05.25 |
[C] 확률 맞추기 프로그램 (0) | 2017.05.18 |
[java] 문자 ↔ 정수 (변환) (0) | 2017.05.14 |
[java] GUI 창 조절 비활성화 (0) | 2017.05.14 |