www.pudn.com > DialogResizeable.zip > maindlg.h, change:2001-10-02,size:2937b


// maindlg.h : interface of the CMainDlg class 
// 
///////////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_MAINDLG_H__02505C15_E31D_4A57_8130_271232A555B3__INCLUDED_) 
#define AFX_MAINDLG_H__02505C15_E31D_4A57_8130_271232A555B3__INCLUDED_ 
 
#if _MSC_VER >= 1000 
#pragma once 
#endif // _MSC_VER >= 1000 
 
#include "CTestDlg.h" 
 
class CMainDlg :  
	public CAxDialogImpl<CMainDlg>,  
	public CUpdateUI<CMainDlg>, 
//	public CDialogSizeable<CTestDlg>, 
	public CMessageFilter,  
	public CIdleHandler 
{ 
public: 
	enum { IDD = IDD_MAINDLG }; 
 
//	CMainDlg(); 
 
	virtual BOOL PreTranslateMessage(MSG* pMsg) 
	{ 
		return IsDialogMessage(pMsg); 
	} 
 
	virtual BOOL OnIdle() 
	{ 
		return FALSE; 
	} 
 
	BEGIN_MSG_MAP(CMainDlg) 
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) 
		COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout) 
		COMMAND_ID_HANDLER(IDOK, OnOK) 
		COMMAND_ID_HANDLER(IDCANCEL, OnCancel) 
 
//		MESSAGE_HANDLER_EX(WM_WINMGR, OnWinMgr) 
 
//		CHAIN_MSG_MAP(CDialogSizeable<CTestDlg>) 
	END_MSG_MAP() 
 
	BEGIN_UPDATE_UI_MAP(CMainDlg) 
	END_UPDATE_UI_MAP() 
 
	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) 
	{ 
		// center the dialog on the screen 
		CenterWindow(); 
 
		// set icons 
		HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),  
			IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); 
		SetIcon(hIcon, TRUE); 
		HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),  
			IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); 
		SetIcon(hIconSmall, FALSE); 
 
		// register object for message filtering and idle updates 
		CMessageLoop* pLoop = _Module.GetMessageLoop(); 
		ATLASSERT(pLoop != NULL); 
		pLoop->AddMessageFilter(this); 
		pLoop->AddIdleHandler(this); 
 
		UIAddChildWindowContainer(m_hWnd); 
 
		return TRUE; 
	} 
 
	LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 
	{ 
		CTestDlg dlg; 
		dlg.DoModal(); 
		return 0; 
	} 
 
	LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 
	{ 
		// TODO: Add validation code  
		CloseDialog(wID); 
		return 0; 
	} 
 
	LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) 
	{ 
		CloseDialog(wID); 
		return 0; 
	} 
 
	void CloseDialog(int nVal) 
	{ 
		DestroyWindow(); 
		::PostQuitMessage(nVal); 
	} 
 
//	LRESULT OnWinMgr(UINT uMsg, WPARAM wp, LPARAM lp) 
//	{ 
//		return 0; 
//	} 
}; 
 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_MAINDLG_H__02505C15_E31D_4A57_8130_271232A555B3__INCLUDED_)