///////////////////////////////////////////////////////////////////////////// // clientDlg.h : Declaration of the CclientDlg #ifndef __CLIENTDLG_H_ #define __CLIENTDLG_H_ #include #include #include "resource.h" // main symbols #include ///////////////////////////////////////////////////////////////////////////// // declarations for user defined event #define WM_USER_EVENT WM_USER+100 void __cdecl doReply(void* idThread); extern HWND hDlg; // handle to dialog window, written in client.cpp class CclientDlg; extern CclientDlg *pDlg; ///////////////////////////////////////////////////////////////////////////// // CclientDlg class CclientDlg : public CAxDialogImpl { public: CclientDlg() { } ~CclientDlg() { } enum { IDD = IDD_CLIENTDLG }; BEGIN_MSG_MAP(CclientDlg) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) MESSAGE_HANDLER(WM_USER_EVENT, OnUserMsg); COMMAND_ID_HANDLER(IDCANCEL, OnCancel) END_MSG_MAP() /////////////////////////////////////////////////////////////// // start thread - just to show that we can run a second thread // in an STA if if does no COM work LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { _beginthread(doReply,0,(void*)GetCurrentThreadId()); return 1; // Let the system set the focus } // /////////////////////////////////////////////////////////////// // This is where we respond to thread's simulated event LRESULT OnUserMsg( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ); /////////////////////////////////////////////////////////////// // shut down dialog and stop message loop LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { PostQuitMessage(0); DestroyWindow(); hDlg = 0; // stop messages to destroyed window pDlg = 0; // " " " " " return 0; } }; #endif //__CLIENTDLG_H_