1 ///////////////////////////////////////
\r
5 #include "MyDialog.h"
\r
7 #include "resource.h"
\r
11 // Definitions for the CMyDialog class
\r
12 CMyDialog::CMyDialog(UINT nResID, CWnd* pParent) : CDialog(nResID, pParent)
\r
16 CMyDialog::~CMyDialog()
\r
20 INT_PTR CMyDialog::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
\r
24 //Additional messages to be handled go here
\r
27 return DialogProcDefault(uMsg, wParam, lParam);
\r
31 BOOL CMyDialog::OnInitDialog()
\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
40 void CMyDialog::OnOK()
\r
41 // This function is called when the OK button is hit
\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
49 // Get the number of test messages to send
\r
50 int nTestMessages = GetDlgItemInt(IDC_MESSAGES, NULL, FALSE);
\r
52 // Get a reference to the CMainWindow object
\r
53 CMainWindow& MainWnd = ((CPerformanceApp*)GetApp())->GetMainWnd();
\r
55 MainWnd.SetTestMessages(nTestMessages);
\r
56 MainWnd.CreateTestWindows(nWindows);
\r