Last active
August 12, 2019 07:01
-
-
Save z4none/5cee7f3e9328cecf0196bc0eba072ede to your computer and use it in GitHub Desktop.
Dialog WinMain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <windows.h> | |
| #include "resource.h" | |
| // | |
| INT_PTR CALLBACK DialogProc( | |
| HWND hwnd, | |
| UINT uMsg, | |
| WPARAM wParam, | |
| LPARAM lParam | |
| ) | |
| { | |
| switch(uMsg) | |
| { | |
| case WM_INITDIALOG: | |
| break; | |
| case WM_CLOSE: | |
| DestroyWindow(hwnd); | |
| break; | |
| case WM_DESTROY: | |
| PostQuitMessage(0); | |
| break; | |
| } | |
| return 0; | |
| } | |
| // | |
| int WINAPI WinMain( | |
| HINSTANCE hInstance, | |
| HINSTANCE hPrevInstance, | |
| LPSTR lpCmdLine, | |
| int nCmdShow | |
| ) | |
| { | |
| // hDlg = CreateDialog(hInstance, TEXT ("ColorScrDlg"), hwnd, DialogProc); | |
| // hDlg = DialogBox(hInstance, TEXT ("ColorScrDlg"), hwnd, DialogProc); | |
| HWND hDlg; | |
| hDlg = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_DLG_MAIN), 0, DialogProc, 0); | |
| ShowWindow(hDlg, nCmdShow); | |
| MSG msg; | |
| while(GetMessage(&msg, NULL, 0, 0)) | |
| { | |
| if(!IsDialogMessage(hDlg, &msg)) | |
| { | |
| TranslateMessage(&msg); | |
| DispatchMessage(&msg); | |
| } | |
| } | |
| return (int)msg.wParam; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment