chenluhua1980
2026-01-24 2a7efcf2a4bac5e7f9813975c87683ea09fb984e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#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;
    BOOL m_bDelayClose;
 
 
// 对话框数据
#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);
};