1 // ============================================================================
7 // This is a Win32-only test for verifying that the ACE dll
8 // initializes itself without having a nonstatic object manager
9 // present by way of a console app's main function. It's a MFC dialog
10 // app - it pops up a dialog and spawns a thread - this source file is
11 // the code for implementing the dialog box.
13 // This test program was initially generated from MSVC AppWizard, then
14 // some files were renamed and moved around to fit in with the ACE
15 // test directory structure.
18 // Steve Huston <shuston@riverace.com>
20 // ============================================================================
22 #if defined(ACE_HAS_MFC)
24 #include "ACE_Init_Test_StdAfx.h"
25 #include "ACE_Init_Test.h"
26 #include "ACE_Init_TestDlg.h"
31 static char THIS_FILE
[] = __FILE__
;
34 /////////////////////////////////////////////////////////////////////////////
35 // CACE_Init_TestDlg dialog
37 CACE_Init_TestDlg::CACE_Init_TestDlg(CWnd
* pParent
/*=NULL*/)
38 : CDialog(CACE_Init_TestDlg::IDD
, pParent
)
40 //{{AFX_DATA_INIT(CACE_Init_TestDlg)
41 // NOTE: the ClassWizard will add member initialization here
43 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
44 m_hIcon
= AfxGetApp()->LoadIcon(IDR_MAINFRAME
);
47 void CACE_Init_TestDlg::DoDataExchange(CDataExchange
* pDX
)
49 CDialog::DoDataExchange(pDX
);
50 //{{AFX_DATA_MAP(CACE_Init_TestDlg)
51 // NOTE: the ClassWizard will add DDX and DDV calls here
55 BEGIN_MESSAGE_MAP(CACE_Init_TestDlg
, CDialog
)
56 //{{AFX_MSG_MAP(CACE_Init_TestDlg)
62 /////////////////////////////////////////////////////////////////////////////
63 // CACE_Init_TestDlg message handlers
65 BOOL
CACE_Init_TestDlg::OnInitDialog()
67 CDialog::OnInitDialog();
69 // Set the icon for this dialog. The framework does this automatically
70 // when the application's main window is not a dialog
71 SetIcon(m_hIcon
, TRUE
); // Set big icon
72 SetIcon(m_hIcon
, FALSE
); // Set small icon
74 // TODO: Add extra initialization here
76 return TRUE
; // return TRUE unless you set the focus to a control
79 // If you add a minimize button to your dialog, you will need the code below
80 // to draw the icon. For MFC applications using the document/view model,
81 // this is automatically done for you by the framework.
83 void CACE_Init_TestDlg::OnPaint()
87 CPaintDC
dc(this); // device context for painting
89 SendMessage(WM_ICONERASEBKGND
, (WPARAM
) dc
.GetSafeHdc(), 0);
91 // Center icon in client rectangle
92 int cxIcon
= GetSystemMetrics(SM_CXICON
);
93 int cyIcon
= GetSystemMetrics(SM_CYICON
);
96 int x
= (rect
.Width() - cxIcon
+ 1) / 2;
97 int y
= (rect
.Height() - cyIcon
+ 1) / 2;
100 dc
.DrawIcon(x
, y
, m_hIcon
);
108 // The system calls this to obtain the cursor to display while the user drags
109 // the minimized window.
110 HCURSOR
CACE_Init_TestDlg::OnQueryDragIcon()
112 return (HCURSOR
) m_hIcon
;
115 #endif /* ACE_HAS_MFC */