#pragma once /////////////////////////////////////////////////////////////// // CompDlg.h - Declares class that implements dialog-based // // user interface // // // // Jim Fawcett, CSE775 - Distributed Objects, Spring 2005 // /////////////////////////////////////////////////////////////// #include "stdafx.h" #include "resource.h" // main symbols #include #include "ATLWindows.h" #include "Monitor.h" // CCompDlg class CCompDlg : public CAxDialogImpl { public: CCompDlg(CATLWindowsModule* p_AtlModule) { p_Module = p_AtlModule; } ~CCompDlg() { } enum { IDD = IDD_COMPDLG }; BEGIN_MSG_MAP(CCompDlg) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedOK) COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnClickedCancel) CHAIN_MSG_MAP(CAxDialogImpl) END_MSG_MAP() // Handler prototypes: // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CAxDialogImpl::OnInitDialog(uMsg, wParam, lParam, bHandled); bHandled = TRUE; SetDlgItemText(IDC_EDIT1,L"Enter some text here"); return 1; // Let the system set the focus } LRESULT OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { wchar_t buffer[256]; GetDlgItemText(IDC_EDIT1,buffer,256); MessageBox(buffer,L"Transferred from Edit Control"); return 0; } LRESULT OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { EndDialog(wID); p_Module->MonitorShutdown(); //////////////////////////////////// // alternately could just send quit message // to the Monitor's message loop // // PostQuitMessage(0); return 0; } private: CATLWindowsModule* p_Module; };