1 // Log_Msg_MFCDlg.cpp : implementation file
2 #include "Log_Msg_MFC.h"
4 #if defined (ACE_WIN32)
6 #include "ace/Log_Msg.h"
8 #include "Log_Msg_MFCDlg.h"
13 static char THIS_FILE
[] = __FILE__
;
16 /////////////////////////////////////////////////////////////////////////////
17 // CAboutDlg dialog used for App About
19 class CAboutDlg
: public CDialog
25 //{{AFX_DATA(CAboutDlg)
26 enum { IDD
= IDD_ABOUTBOX
};
29 // ClassWizard generated virtual function overrides
30 //{{AFX_VIRTUAL(CAboutDlg)
32 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
37 //{{AFX_MSG(CAboutDlg)
42 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD
)
44 //{{AFX_DATA_INIT(CAboutDlg)
48 void CAboutDlg::DoDataExchange(CDataExchange
* pDX
)
50 CDialog::DoDataExchange(pDX
);
51 //{{AFX_DATA_MAP(CAboutDlg)
55 BEGIN_MESSAGE_MAP(CAboutDlg
, CDialog
)
56 //{{AFX_MSG_MAP(CAboutDlg)
57 // No message handlers
61 /////////////////////////////////////////////////////////////////////////////
62 // CLog_Msg_MFCDlg dialog
64 CLog_Msg_MFCDlg::CLog_Msg_MFCDlg(CWnd
* pParent
/*=0*/)
65 : CDialog(CLog_Msg_MFCDlg::IDD
, pParent
)
67 //{{AFX_DATA_INIT(CLog_Msg_MFCDlg)
68 // NOTE: the ClassWizard will add member initialization here
70 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
71 m_hIcon
= AfxGetApp()->LoadIcon(IDR_MAINFRAME
);
74 void CLog_Msg_MFCDlg::DoDataExchange(CDataExchange
* pDX
)
76 CDialog::DoDataExchange(pDX
);
77 //{{AFX_DATA_MAP(CLog_Msg_MFCDlg)
78 // NOTE: the ClassWizard will add DDX and DDV calls here
82 BEGIN_MESSAGE_MAP(CLog_Msg_MFCDlg
, CDialog
)
83 //{{AFX_MSG_MAP(CLog_Msg_MFCDlg)
87 ON_BN_CLICKED(IDC_BUTTON1
, OnDebugButtonClicked
)
92 /////////////////////////////////////////////////////////////////////////////
93 // CLog_Msg_MFCDlg message handlers
95 BOOL
CLog_Msg_MFCDlg::OnInitDialog()
97 CDialog::OnInitDialog();
100 // Add "About..." menu item to system menu.
102 // IDM_ABOUTBOX must be in the system command range.
103 ASSERT((IDM_ABOUTBOX
& 0xFFF0) == IDM_ABOUTBOX
);
104 ASSERT(IDM_ABOUTBOX
< 0xF000);
106 CMenu
* pSysMenu
= GetSystemMenu(FALSE
);
109 CString strAboutMenu
;
110 strAboutMenu
.LoadString(IDS_ABOUTBOX
);
111 if (!strAboutMenu
.IsEmpty())
113 pSysMenu
->AppendMenu(MF_SEPARATOR
);
114 pSysMenu
->AppendMenu(MF_STRING
, IDM_ABOUTBOX
, strAboutMenu
);
118 // Set the icon for this dialog. The framework does this automatically
119 // when the application's main window is not a dialog
120 SetIcon(m_hIcon
, TRUE
); // Set big icon
121 SetIcon(m_hIcon
, FALSE
);// Set small icon
123 // TODO: Add extra initialization here
125 return TRUE
; // return TRUE unless you set the focus to a control
128 void CLog_Msg_MFCDlg::OnSysCommand(UINT nID
, LPARAM lParam
)
130 if ((nID
& 0xFFF0) == IDM_ABOUTBOX
)
137 CDialog::OnSysCommand(nID
, lParam
);
141 // If you add a minimize button to your dialog, you will need the code below
142 // to draw the icon. For MFC applications using the document/view model,
143 // this is automatically done for you by the framework.
145 void CLog_Msg_MFCDlg::OnPaint()
149 CPaintDC
dc(this); // device context for painting
151 // Center icon in client rectangle
152 int cxIcon
= GetSystemMetrics(SM_CXICON
);
153 int cyIcon
= GetSystemMetrics(SM_CYICON
);
155 GetClientRect(&rect
);
156 int x
= (rect
.Width() - cxIcon
+ 1) / 2;
157 int y
= (rect
.Height() - cyIcon
+ 1) / 2;
160 dc
.DrawIcon(x
, y
, m_hIcon
);
168 // The system calls this to obtain the cursor to display while the user drags
169 // the minimized window.
170 HCURSOR
CLog_Msg_MFCDlg::OnQueryDragIcon()
172 return (HCURSOR
) m_hIcon
;
175 void CLog_Msg_MFCDlg::OnDebugButtonClicked()
177 ACE_DEBUG(( LM_DEBUG
, "Debug message sent!\n" ));
180 #endif /* ACE_WIN32 */