Skip to content

Instantly share code, notes, and snippets.

@z4none
Last active August 12, 2019 07:01
Show Gist options
  • Select an option

  • Save z4none/5cee7f3e9328cecf0196bc0eba072ede to your computer and use it in GitHub Desktop.

Select an option

Save z4none/5cee7f3e9328cecf0196bc0eba072ede to your computer and use it in GitHub Desktop.
Dialog WinMain
#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