#pragma once // CMsgDlg 对话框 #define MSG_BOX_TIP 0x00 #define MSG_BOX_QUESTION 0x01 #define MSG_BOX_WARNING 0x02 #define MSG_BOX_ERROR 0x03 #define MSG_BOX_SUCCEED 0x04 class CMsgDlg : public CDialogEx { DECLARE_DYNAMIC(CMsgDlg) public: CMsgDlg(CWnd* pParent = nullptr); // 标准构造函数 CMsgDlg(CString strTitle, CString strMessage); CMsgDlg(int nIcon, CString strTitle, CString strMessage); virtual ~CMsgDlg(); public: void BeginThread(AFX_THREADPROC pfnThreadProc); void SetIcon(int nIcon); void SetTitle(CString strTitle); void SetMessage(CString strMessage); void DelayClose(int nDelay); void SetMarquee(_In_ BOOL fMarqueeMode, _In_ int nInterval); void ShowCloseButton(BOOL bVisible); void SetCompleteCode(int code); int GetCompleteCode(); void SetData(DWORD_PTR dwData); DWORD_PTR GetData(); void SetDataEx(DWORD_PTR dwData); DWORD_PTR GetDataEx(); private: void Resize(); void UpdateIcon(); private: COLORREF m_crBkgnd; CBrush m_brBkgnd; int m_nIcon; CString m_strTitle; CString m_strMessage; COLORREF m_crTitle; COLORREF m_crMessage; CFont m_fontTitle; CFont m_fontMsg; int m_nCompleteCode; DWORD_PTR m_dwData; DWORD_PTR m_dwDataEx; // 对话框数据 #ifdef AFX_DESIGN_TIME enum { IDD = IDD_DIALOG_MSG }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 DECLARE_MESSAGE_MAP() public: virtual BOOL OnInitDialog(); afx_msg void OnTimer(UINT_PTR nIDEvent); virtual BOOL PreTranslateMessage(MSG* pMsg); afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); afx_msg void OnSize(UINT nType, int cx, int cy); };