Merge branch 'master' of git.ucc.asn.au:/matches/honours
[matches/honours.git] / research / transmission_spectroscopy / TOF / Win32++ / samples / Performance / src / MyDialog.cpp
1 ///////////////////////////////////////\r
2 // MyDialog.cpp\r
3 \r
4 #include "stdafx.h"\r
5 #include "MyDialog.h"\r
6 #include "PerfApp.h"\r
7 #include "resource.h"\r
8 \r
9 \r
10 \r
11 // Definitions for the CMyDialog class\r
12 CMyDialog::CMyDialog(UINT nResID, CWnd* pParent) : CDialog(nResID, pParent)\r
13 {\r
14 }\r
15 \r
16 CMyDialog::~CMyDialog()\r
17 {\r
18 }\r
19 \r
20 INT_PTR CMyDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
21 {\r
22 //      switch (uMsg)\r
23 //      {\r
24                 //Additional messages to be handled go here\r
25 //      }\r
26 \r
27         return DialogProcDefault(uMsg, wParam, lParam);\r
28 }\r
29 \r
30 \r
31 BOOL CMyDialog::OnInitDialog()\r
32 {\r
33         // Put the initial values in the edit boxes\r
34         SetDlgItemText(IDC_WINDOWS,  _T("10"));\r
35         SetDlgItemText(IDC_MESSAGES, _T("1000000"));\r
36 \r
37         return true;\r
38 }\r
39 \r
40 void CMyDialog::OnOK()\r
41 // This function is called when the OK button is hit\r
42 {\r
43         // Get the number of test windows to create \r
44         // Note 1: A Windows limit of 10000 handles per process imposes a practical limit of aprox 1000 test windows.\r
45         //         Refer to: http://support.microsoft.com/kb/327699\r
46         // Note 2: Creating (or destroying) more than say 200 windows may temporarily stress the Explorer process.\r
47         int nWindows = MIN(1000, GetDlgItemInt(IDC_WINDOWS, NULL, FALSE));\r
48         \r
49         // Get the number of test messages to send\r
50         int nTestMessages = GetDlgItemInt(IDC_MESSAGES, NULL, FALSE);\r
51 \r
52         // Get a reference to the CMainWindow object\r
53         CMainWindow& MainWnd = ((CPerformanceApp*)GetApp())->GetMainWnd();\r
54         \r
55         MainWnd.SetTestMessages(nTestMessages);\r
56         MainWnd.CreateTestWindows(nWindows);\r
57 \r
58         // End the dialog\r
59         EndDialog(IDOK);\r
60 }\r
61 \r

UCC git Repository :: git.ucc.asn.au