Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "DialogWnd.h"
- DialogWnd::DialogWnd()
- {
- InitCommonControls();
- InitWindow(0, 0, 0, 0);
- }
- DialogWnd::DialogWnd(HINSTANCE hInstance, HINSTANCE h0, LPTSTR lpCmdLine, int nCmdShow)
- {
- InitCommonControls();
- InitWindow(hInstance, h0, lpCmdLine, nCmdShow);
- }
- DialogWnd::~DialogWnd() {}
- int DialogWnd::InitWindow(HINSTANCE hInstance, HINSTANCE h0, LPTSTR lpCommandLine, int nCmdShow)
- {
- hDialog = reinterpret_cast<HWND>(DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_DIALOG), 0, DialogProc, 0));
- ShowWindow(hDialog, nCmdShow);
- while ((ret = GetMessage(&msg, 0, 0, 0)) != 0)
- {
- if (ret == -1) return -1;
- if (!IsDialogMessage(hDialog, &msg))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- return 0;
- }
- INT_PTR DialogWnd::DialogProc(HWND hDialog, UINT uMsg, WPARAM wParam, LPARAM lParam)
- {
- switch(uMsg)
- {
- case WM_INITDIALOG:
- SetDlgItemText(hDialog, IDC_EDIT1, _T("off"));
- return TRUE;
- case WM_CLOSE:
- return TRUE;
- case WM_DESTROY:
- PostQuitMessage(0);
- return TRUE;
- }
- return FALSE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement