Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / examples / Log_Msg / Log_Msg_MFC / Log_Msg_MFCDlg.cpp
blob1e476e4bb89bf34ca7f453080e323250fbc9eab9
1 // Log_Msg_MFCDlg.cpp : implementation file
2 #include "Log_Msg_MFC.h"
4 #if defined (ACE_WIN32)
6 #include "ace/Log_Msg.h"
7 #include "stdafx.h"
8 #include "Log_Msg_MFCDlg.h"
10 #ifdef _DEBUG
11 #define new DEBUG_NEW
12 #undef THIS_FILE
13 static char THIS_FILE[] = __FILE__;
14 #endif
16 /////////////////////////////////////////////////////////////////////////////
17 // CAboutDlg dialog used for App About
19 class CAboutDlg : public CDialog
21 public:
22 CAboutDlg();
24 // Dialog Data
25 //{{AFX_DATA(CAboutDlg)
26 enum { IDD = IDD_ABOUTBOX };
27 //}}AFX_DATA
29 // ClassWizard generated virtual function overrides
30 //{{AFX_VIRTUAL(CAboutDlg)
31 protected:
32 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
33 //}}AFX_VIRTUAL
35 // Implementation
36 protected:
37 //{{AFX_MSG(CAboutDlg)
38 //}}AFX_MSG
39 DECLARE_MESSAGE_MAP()
42 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
44 //{{AFX_DATA_INIT(CAboutDlg)
45 //}}AFX_DATA_INIT
48 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
50 CDialog::DoDataExchange(pDX);
51 //{{AFX_DATA_MAP(CAboutDlg)
52 //}}AFX_DATA_MAP
55 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
56 //{{AFX_MSG_MAP(CAboutDlg)
57 // No message handlers
58 //}}AFX_MSG_MAP
59 END_MESSAGE_MAP()
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
69 //}}AFX_DATA_INIT
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
79 //}}AFX_DATA_MAP
82 BEGIN_MESSAGE_MAP(CLog_Msg_MFCDlg, CDialog)
83 //{{AFX_MSG_MAP(CLog_Msg_MFCDlg)
84 ON_WM_SYSCOMMAND()
85 ON_WM_PAINT()
86 ON_WM_QUERYDRAGICON()
87 ON_BN_CLICKED(IDC_BUTTON1, OnDebugButtonClicked)
88 ON_WM_CLOSE()
89 //}}AFX_MSG_MAP
90 END_MESSAGE_MAP()
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);
107 if (pSysMenu != 0)
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)
132 CAboutDlg dlgAbout;
133 dlgAbout.DoModal();
135 else
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()
147 if (IsIconic())
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);
154 CRect rect;
155 GetClientRect(&rect);
156 int x = (rect.Width() - cxIcon + 1) / 2;
157 int y = (rect.Height() - cyIcon + 1) / 2;
159 // Draw the icon
160 dc.DrawIcon(x, y, m_hIcon);
162 else
164 CDialog::OnPaint();
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 */