///////////////////////////////////////////////////////////////// // Demo.h - Basic Demonstration of ATL Dialog Window Project // // // // Jim Fawcett, CSE775 - Distributed Objects, Spring 2005 // ///////////////////////////////////////////////////////////////// #pragma once #include "resource.h" // main symbols #include #include // CDemo class CDemo : public CAxDialogImpl { public: CDemo() { } ~CDemo() { } enum { IDD = IDD_DIALOG1 }; BEGIN_MSG_MAP(CDemo) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedOK) COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnClickedCancel) CHAIN_MSG_MAP(CAxDialogImpl) END_MSG_MAP() LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CAxDialogImpl::OnInitDialog(uMsg, wParam, lParam, bHandled); CenterWindow(); std::string str = " Hello ATL World\r\n CSE775 - Distributed Objects\r\n Spring 2004"; SetDlgItemText(IDC_EDIT1,str.c_str()); return 1; // Let the system set the focus } LRESULT OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { const int MAX = 100; char buffer[MAX]; GetDlgItemText(IDC_EDIT1,buffer,MAX); MessageBox(buffer,"On OK"); HWND hWnd = GetDlgItem(IDC_EDIT1); GotoDlgCtrl(hWnd); // EndDialog(wID); return 0; } LRESULT OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { EndDialog(wID); return 0; } };