bench.c
Upload User: caisha3
Upload Date: 2013-09-21
Package Size: 208739k
Code Size: 50k
Category:

Windows Develop

Development Platform:

Visual C++

  1. /*++
  2. Copyright (c) 1996  Microsoft Corporation
  3. Module Name
  4.    bench.c
  5. Abstract:
  6.    Measure time for a number of API calls or small application modules
  7. Author:
  8.    Dan Almosnino (danalm) July 96
  9.    Based on code by (MarkE) and DarrinM
  10. Enviornment:
  11.    User Mode
  12. Revision History:
  13.     Dan Almosnino (danalm) 20-Sept-195
  14. 1. Timer call modified to run on both NT and WIN95.
  15.     Dan Almosnino (danalm) 20-Nov-1995
  16. 1.  Modified Timer call to measure Pentium cycle counts when applicable
  17. 2.  Modified default numbers for test iterations to accomodate the statistical module add-on.
  18.     (Typically 10 test samples are taken, doing 10-1000 iterations each).
  19.     Dan Almosnino (danalm) 25-July-96
  20. 1.  Adapted to the same format as that of GDIbench, including the features above.
  21. 2.  Cleanup some tests.
  22. --*/
  23. #include "precomp.h"
  24. #include "bench.h"
  25. #include "usrbench.h"
  26. #include "resource.h"
  27. #ifndef WIN32
  28. #define APIENTRY FAR PASCAL
  29. typedef int INT;
  30. typedef char CHAR;
  31. #endif
  32. #define SETWINDOWLONGVAL  99999L
  33. /*
  34.  * Function prototypes
  35.  */
  36. INT_PTR APIENTRY FileOpenDlgProc(HWND, UINT, WPARAM, LPARAM);
  37. INT_PTR APIENTRY ClearDlg(HWND, UINT, WPARAM, LPARAM);
  38. INT_PTR APIENTRY ClearDlgNoState(HWND, UINT, WPARAM, LPARAM);
  39. LRESULT APIENTRY CreateDestroyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  40. LRESULT APIENTRY CreateDestroyWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  41. #ifdef ASSERT
  42. #undef ASSERT
  43. #endif
  44. #define ASSERT(expr)    if (!(expr)) { char szBuf[256];                   
  45. sprintf(szBuf,"Assertion Failure %s %ld:"#expr"n", __FILE__, __LINE__);  
  46. MessageBox(NULL, szBuf, "Assert Failure", MB_OK); }
  47. static void DispErrorMsg(const char* title)
  48. {
  49.     LPVOID msgbuf;
  50.     if (title == NULL) {
  51.         title = "Error";
  52.     }
  53.     FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
  54.         NULL,
  55.         GetLastError(),
  56.         MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
  57.         (LPTSTR) &msgbuf,
  58.         0,
  59.         NULL);
  60.     MessageBox(NULL, msgbuf, title, MB_OK | MB_ICONEXCLAMATION);
  61.     LocalFree(msgbuf);
  62. }
  63. /*
  64.  * Global variables
  65.  */
  66. CHAR *aszTypical[] = {
  67.     "change", "alteration", "amendment", "mutation", "permutation",
  68.     "variation", "substitution", "modification", "transposition",
  69.     "transformation"
  70. };
  71. INT NStrings = sizeof(aszTypical)/sizeof(aszTypical[0]);
  72. BOOL gfSetFocus = TRUE;
  73. #define PROPCLASSNAME TEXT("PropWindow")
  74. /*
  75.  * External global variables.
  76.  */
  77. extern HWND ghwndFrame, ghwndMDIClient;
  78. extern HANDLE ghinst;
  79. /*++
  80. Routine Description:
  81.     Measure start count
  82. Arguments
  83. Return Value - Performance Count
  84. --*/
  85. extern BOOL gfPentium;
  86. _int64
  87. BeginTimeMeasurement()
  88. {
  89.     _int64 PerformanceCount;
  90.     extern BOOL gfUseCycleCount;
  91. #ifdef _X86_
  92.                 SYSTEM_INFO SystemInfo;
  93.                 GetSystemInfo(&SystemInfo);
  94.                 if(gfUseCycleCount&&(PROCESSOR_INTEL_PENTIUM==SystemInfo.dwProcessorType))
  95.                         gfPentium = TRUE;
  96.                 else
  97. #endif
  98.                         gfPentium = FALSE;
  99. #ifdef _X86_
  100.                 if(gfPentium)
  101.                     PerformanceCount = GetCycleCount();
  102.                 else
  103. #endif
  104.                 QueryPerformanceCounter((LARGE_INTEGER *)&PerformanceCount);
  105.     return(PerformanceCount);
  106. }
  107. /*++
  108. Routine Description:
  109.     Measure stop count and return the calculated time difference
  110. Arguments
  111.     StartTime   = Start Time Count
  112.     Iter        = No. of Test Iterations
  113. Return Value - Test Time per Iteration, in 100 nano-second units
  114. --*/
  115. ULONGLONG
  116. EndTimeMeasurement(
  117.     _int64  StartTime,
  118.     ULONG      Iter)
  119. {
  120.    _int64 PerformanceCount;
  121.    extern  _int64 PerformanceFreq;
  122.    extern  BOOL gfPentium;
  123. #ifdef _X86_
  124.                 if(gfPentium)
  125.                 {
  126.                     PerformanceCount = GetCycleCount();
  127.                     PerformanceCount -= CCNT_OVERHEAD;
  128.                 }
  129.                 else
  130. #endif
  131.                     QueryPerformanceCounter((LARGE_INTEGER *)&PerformanceCount);
  132.    PerformanceCount -= StartTime ;
  133. #ifdef _X86_
  134.                 if(gfPentium)
  135.                     PerformanceCount /= Iter;
  136.                 else
  137. #endif
  138.                     PerformanceCount /= (PerformanceFreq * Iter); // Result is in 100ns units
  139.                                                                   // because PerformanceFreq
  140.                                                                   // was set to Counts/(100ns)
  141.    return((ULONGLONG)PerformanceCount);
  142. }
  143. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  144. /*++
  145. Routine Description:
  146.    Measure APIs
  147. Arguments
  148.    hdc   - dc
  149.    iter  - number of times to call
  150. Return Value
  151.    time for calls
  152. --*/
  153. /***************************************************************************
  154. * RegisterClass
  155. *
  156. *
  157. * History:
  158. ***************************************************************************/
  159. ULONGLONG
  160. msProfRegisterClass(
  161.     HDC hdc,
  162.     ULONG Iter)
  163. {
  164.     INIT_TIMER;
  165.     WNDCLASS wc;
  166.     wc.style            = 0;
  167.     wc.lpfnWndProc      = CreateDestroyWndProc;
  168.     wc.cbClsExtra       = 0;
  169.     wc.cbWndExtra       = 0;
  170.     wc.hInstance        = ghinst;
  171.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  172.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  173.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  174.     wc.lpszMenuName     = NULL;
  175.     wc.lpszClassName    = PROPCLASSNAME;
  176.     START_TIMER;
  177.     while (ix--)
  178.     {
  179.         RegisterClass(&wc);
  180.         UnregisterClass(PROPCLASSNAME, ghinst);
  181.     }
  182.     END_TIMER;
  183. }
  184. /***************************************************************************
  185. * Class Query APIs
  186. *
  187. *
  188. * History:
  189. ***************************************************************************/
  190. ULONGLONG msProfClassGroup(HDC hdc, ULONG Iter)
  191. {
  192.     char szBuf[50];
  193.     HICON hIcon;
  194.     INIT_TIMER;
  195.     WNDCLASS wc;
  196.     wc.style            = 0;
  197.     wc.lpfnWndProc      = CreateDestroyWndProc;
  198.     wc.cbClsExtra       = 0;
  199.     wc.cbWndExtra       = 0;
  200.     wc.hInstance        = ghinst;
  201.     wc.hIcon            = hIcon = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  202.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  203.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  204.     wc.lpszMenuName     = NULL;
  205.     wc.lpszClassName    = PROPCLASSNAME;
  206.     RegisterClass(&wc);
  207.     START_TIMER;
  208.     while (ix--)
  209.     {
  210.         GetClassInfo(ghinst, PROPCLASSNAME, &wc);
  211.         GetClassName(ghwndFrame, szBuf, sizeof(szBuf)/sizeof(szBuf[0]));
  212.         GetClassLongPtr(ghwndFrame, GCLP_HBRBACKGROUND);
  213.         SetClassLongPtr(ghwndFrame, GCLP_HICON, (LONG_PTR)hIcon);
  214.     }
  215.     END_TIMER_NO_RETURN;
  216.     UnregisterClass(PROPCLASSNAME, ghinst);
  217.     RETURN_STOP_TIME;
  218. }
  219. /***************************************************************************
  220. * Clipboard APIs tests
  221. *
  222. *
  223. * History:
  224. ***************************************************************************/
  225. ULONGLONG msProfClipboardGroup(HDC hdc, ULONG Iter)
  226. {
  227.     INIT_TIMER;
  228.     HGLOBAL h;
  229.     int i;
  230.     START_TIMER;
  231.     while (ix--)
  232.     {
  233.         START_OVERHEAD;
  234.         h = GlobalAlloc(GPTR | GMEM_DDESHARE, 80);
  235.         strcpy( h, "hello");
  236.         END_OVERHEAD;
  237.         OpenClipboard(ghwndFrame);
  238.         EmptyClipboard();
  239.         SetClipboardData(CF_TEXT, h);
  240.         GetClipboardData(CF_TEXT);
  241.         CloseClipboard();
  242.     }
  243.     END_TIMER_NO_RETURN;
  244.     RETURN_STOP_TIME;
  245. }
  246. /***************************************************************************
  247. * ProfAvgDlgDraw
  248. *
  249. *
  250. * History:
  251. ***************************************************************************/
  252. ULONGLONG msProfAvgDlgDraw(HDC hdc, ULONG Iter)
  253. {
  254.     CHAR szFile[128];
  255.     INIT_TIMER;
  256.     HWND hwnd = CreateDialogParam(ghinst, MAKEINTRESOURCE(CLEARBOX), ghwndFrame,
  257.             ClearDlg, MAKELONG(szFile,0));
  258.     START_TIMER;
  259.     while (ix--)
  260.     {
  261.         ShowWindow(hwnd, TRUE);
  262.         UpdateWindow(hwnd);
  263.         ShowWindow(hwnd, FALSE);
  264.     }
  265.     END_TIMER_NO_RETURN;
  266.     DestroyWindow(hwnd);
  267.     RETURN_STOP_TIME;
  268. }
  269. ULONGLONG msProfAvgDlgCreate(HDC hdc, ULONG Iter)
  270. {
  271.     HWND hwnd;
  272.     CHAR szFile[128];
  273.     INIT_TIMER;
  274.     START_TIMER;
  275.     while (ix--)
  276.     {
  277.         hwnd = CreateDialogParam(ghinst, MAKEINTRESOURCE(CLEARBOX), ghwndFrame,
  278.                 ClearDlg, MAKELONG(szFile,0));
  279.         ShowWindow(hwnd, TRUE);
  280.         UpdateWindow(hwnd);
  281.         DestroyWindow(hwnd);
  282.     }
  283.     END_TIMER_NO_RETURN;
  284.     RETURN_STOP_TIME;
  285. }
  286. ULONGLONG msProfAvgDlgCreateDestroy(HDC hdc, ULONG Iter)
  287. {
  288.     HWND hwnd;
  289.     CHAR szFile[128];
  290.     INIT_TIMER;
  291.     gfSetFocus = FALSE;     // Trying to minimize GDI's impact.
  292.     START_TIMER;
  293.     while (ix--)
  294.     {
  295.         hwnd = CreateDialogParam(ghinst, MAKEINTRESOURCE(CLEARBOX), ghwndFrame,
  296.                 ClearDlg, MAKELONG(szFile,0));
  297.         DestroyWindow(hwnd);
  298.     }
  299.     END_TIMER_NO_RETURN;
  300.     gfSetFocus = TRUE;
  301.     RETURN_STOP_TIME;
  302. }
  303. ULONGLONG msProfAvgDlgCreateDestroyNoMenu(HDC hdc, ULONG Iter)
  304. {
  305.     HWND hwnd;
  306.     CHAR szFile[128];
  307.     INIT_TIMER;
  308.     gfSetFocus = FALSE;     // Trying to minimize GDI's impact.
  309.     START_TIMER;
  310.     while (ix--)
  311.     {
  312.         hwnd = CreateDialogParam(ghinst, MAKEINTRESOURCE(CLEARBOXNOMENU), ghwndFrame,
  313.                 ClearDlg, MAKELONG(szFile,0));
  314.         DestroyWindow(hwnd);
  315.     }
  316.     END_TIMER_NO_RETURN;
  317.     gfSetFocus = TRUE;
  318.     RETURN_STOP_TIME;
  319. }
  320. ULONGLONG msProfAvgDlgCreateDestroyNoFont(HDC hdc, ULONG Iter)
  321. {
  322.     HWND hwnd;
  323.     CHAR szFile[128];
  324.     INIT_TIMER;
  325.     gfSetFocus = FALSE;     // Trying to minimize GDI's impact.
  326.     START_TIMER;
  327.     while (ix--)
  328.     {
  329.         hwnd = CreateDialogParam(ghinst, MAKEINTRESOURCE(CLEARBOXNOFONT), ghwndFrame,
  330.                 ClearDlg, MAKELONG(szFile,0));
  331.         DestroyWindow(hwnd);
  332.     }
  333.     END_TIMER_NO_RETURN;
  334.     gfSetFocus = TRUE;
  335.     RETURN_STOP_TIME;
  336. }
  337. ULONGLONG msProfAvgDlgCreateDestroyEmpty(HDC hdc, ULONG Iter)
  338. {
  339.     HWND hwnd;
  340.     CHAR szFile[128];
  341.     INIT_TIMER;
  342.     gfSetFocus = FALSE;     // Trying to minimize GDI's impact.
  343.     START_TIMER;
  344.     while (ix--)
  345.     {
  346.         hwnd = CreateDialogParam(ghinst, MAKEINTRESOURCE(EMPTY), ghwndFrame,
  347.                 ClearDlgNoState, MAKELONG(szFile,0));
  348.         DestroyWindow(hwnd);
  349.     }
  350.     END_TIMER_NO_RETURN;
  351.     gfSetFocus = TRUE;
  352.     RETURN_STOP_TIME;
  353. }
  354. ULONGLONG msProfCreateDestroyWindow(HDC hdc, ULONG Iter)
  355. {
  356.     HWND hwnd;
  357.     INIT_TIMER;
  358.     WNDCLASS wc;
  359.     if(!ghinst)MessageBox(GetParent(ghwndMDIClient), "1ghinst==0","ERROR!", MB_OK);
  360.     wc.style            = 0;
  361.     wc.lpfnWndProc      = CreateDestroyWndProc;
  362.     wc.cbClsExtra       = 0;
  363.     wc.cbWndExtra       = 0;
  364.     wc.hInstance        = ghinst;
  365.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  366.     wc.hCursor          = LoadCursor((HINSTANCE)NULL, IDC_ARROW);
  367.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  368.     wc.lpszMenuName     = NULL;
  369.     wc.lpszClassName    = "CreateDestroyWindow";
  370.     if (!RegisterClass(&wc)) {
  371.         MessageBox(GetParent(ghwndMDIClient), "1RegisterClass call failed.",
  372.                 "ERROR!", MB_OK);
  373.         return (ULONGLONG)(0);
  374.     }
  375.     START_TIMER;
  376.     while (ix--)
  377.     {
  378.         hwnd = CreateWindow("CreateDestroyWindow", "Create/DestroyWindow test",
  379.                 WS_OVERLAPPEDWINDOW,
  380.                 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  381.                 NULL, NULL, ghinst, NULL);
  382.         if (hwnd == NULL) {
  383.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  384.                     "ERROR!", MB_OK);
  385.             break;
  386.         }
  387.         DestroyWindow(hwnd);
  388.     }
  389.     END_TIMER_NO_RETURN;
  390.     UnregisterClass("CreateDestroyWindow", ghinst);
  391.     RETURN_STOP_TIME;
  392. }
  393. ULONGLONG msProfCreateDestroyChildWindow(HDC hdc, ULONG Iter)
  394. {
  395.     HWND hwnd, hwndParent;
  396.     INIT_TIMER;
  397.     WNDCLASS wc;
  398.     wc.style            = 0;
  399.     wc.lpfnWndProc      = CreateDestroyWndProc;
  400.     wc.cbClsExtra       = 0;
  401.     wc.cbWndExtra       = 0;
  402.     wc.hInstance        = ghinst;
  403.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  404.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  405.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  406.     wc.lpszMenuName     = NULL;
  407.     wc.lpszClassName    = "CreateDestroyWindow";
  408.     if (!RegisterClass(&wc)) {
  409.         MessageBox(GetParent(ghwndMDIClient), "2RegisterClass call failed.",
  410.                 "ERROR!", MB_OK);
  411.         return (ULONGLONG)(0);
  412.     }
  413.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  414.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  415.             ghwndMDIClient, NULL, ghinst, NULL);
  416.     START_TIMER;
  417.     while (ix--)
  418.     {
  419.         hwnd = CreateWindow("CreateDestroyWindow", "Create/DestroyWindow test",
  420.                 WS_CHILD,
  421.                 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  422.                 hwndParent, NULL, ghinst, NULL);
  423.         if (hwnd == NULL) {
  424.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  425.                     "ERROR!", MB_OK);
  426.             break;
  427.         }
  428.         DestroyWindow(hwnd);
  429.     }
  430.     END_TIMER_NO_RETURN;
  431.     DestroyWindow(hwndParent);
  432.     UnregisterClass("CreateDestroyWindow", ghinst);
  433.     RETURN_STOP_TIME;
  434. }
  435. LRESULT APIENTRY CreateDestroyWndProc(
  436.     HWND hwnd,
  437.     UINT msg,
  438.     WPARAM wParam,
  439.     LPARAM lParam)
  440. {
  441.     switch (msg) {
  442.     case WM_SETTEXT:
  443.     case WM_GETTEXTLENGTH:
  444.         break;
  445.     default:
  446.         return DefWindowProc(hwnd, msg, wParam, lParam);
  447.     }
  448.     return 0;
  449. }
  450. LRESULT APIENTRY CreateDestroyWndProcW(
  451.     HWND hwnd,
  452.     UINT msg,
  453.     WPARAM wParam,
  454.     LPARAM lParam)
  455. {
  456.     switch (msg) {
  457.     case WM_SETTEXT:
  458.     case WM_GETTEXTLENGTH:
  459.         break;
  460.     default:
  461.         return DefWindowProcW(hwnd, msg, wParam, lParam);
  462.     }
  463.     return 0;
  464. }
  465. ULONGLONG msProfLocalAllocFree(HDC hdc, ULONG Iter)
  466. {
  467.     HANDLE h1, h2, h3, h4, h5;
  468.     INIT_TIMER;
  469.     START_TIMER;
  470.     // Try to stress the heap a little bit more than just doing a
  471.     // series of Alloc/Frees.
  472.     while (ix--)                         // originally ix<Iter/5 as well
  473.     {
  474.         h1 = LocalAlloc(0, 500);
  475.         h2 = LocalAlloc(0, 600);
  476.         h3 = LocalAlloc(0, 700);
  477.         LocalFree(h2);
  478.         h4 = LocalAlloc(0, 1000);
  479.         h5 = LocalAlloc(0, 100);
  480.         LocalFree(h1);
  481.         LocalFree(h3);
  482.         LocalFree(h4);
  483.         LocalFree(h5);
  484.     }
  485.     END_TIMER;
  486. }
  487. ULONGLONG msProfGetWindowLong(HDC hdc, ULONG Iter)
  488. {
  489.     HWND hwnd;
  490.     INIT_TIMER;
  491.     LONG l;
  492.     WNDCLASS wc;
  493.     wc.style            = 0;
  494.     wc.lpfnWndProc      = CreateDestroyWndProc;
  495.     wc.cbClsExtra       = 0;
  496.     wc.cbWndExtra       = 4;
  497.     wc.hInstance        = ghinst;
  498.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  499.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  500.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  501.     wc.lpszMenuName     = NULL;
  502.     wc.lpszClassName    = "CreateDestroyWindow";
  503.     if (!RegisterClass(&wc)) {
  504.         MessageBox(GetParent(ghwndMDIClient), "3RegisterClass call failed.",
  505.                 "ERROR!", MB_OK);
  506.         return (ULONGLONG)(0);
  507.     }
  508.     hwnd = CreateWindow("CreateDestroyWindow", "Create/DestroyWindow test",
  509.             WS_OVERLAPPEDWINDOW,
  510.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  511.             NULL, NULL, ghinst, NULL);
  512.     if (hwnd == NULL) {
  513.         MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  514.                 "ERROR!", MB_OK);
  515.         return (ULONGLONG)(0);
  516.     }
  517.     START_TIMER;
  518.     while (ix--)
  519.         l = GetWindowLong(hwnd, 0);
  520.     END_TIMER_NO_RETURN;
  521.     DestroyWindow(hwnd);
  522.     UnregisterClass("CreateDestroyWindow", ghinst);
  523.     RETURN_STOP_TIME;
  524. }
  525. ULONGLONG msProfSetWindowLong(HDC hdc, ULONG Iter)
  526. {
  527.     HWND hwnd;
  528.     INIT_TIMER;
  529.     LONG l;
  530.     WNDCLASS wc;
  531.     wc.style            = 0;
  532.     wc.lpfnWndProc      = CreateDestroyWndProc;
  533.     wc.cbClsExtra       = 0;
  534.     wc.cbWndExtra       = 4;
  535.     wc.hInstance        = ghinst;
  536.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  537.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  538.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  539.     wc.lpszMenuName     = NULL;
  540.     wc.lpszClassName    = "CreateDestroyWindow";
  541.     if (!RegisterClass(&wc)) {
  542.         MessageBox(GetParent(ghwndMDIClient), "4RegisterClass call failed.",
  543.                 "ERROR!", MB_OK);
  544.         return (ULONGLONG)(0);
  545.     }
  546.     hwnd = CreateWindow("CreateDestroyWindow", "Create/DestroyWindow test",
  547.             WS_OVERLAPPEDWINDOW,
  548.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  549.             NULL, NULL, ghinst, NULL);
  550.     if (hwnd == NULL) {
  551.         MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  552.                 "ERROR!", MB_OK);
  553.         return (ULONGLONG)(0);
  554.     }
  555.     START_TIMER;
  556.     while (ix--)
  557.         l = SetWindowLong(hwnd, 0, SETWINDOWLONGVAL);
  558.     END_TIMER_NO_RETURN;
  559.     DestroyWindow(hwnd);
  560.     UnregisterClass("CreateDestroyWindow", ghinst);
  561.     RETURN_STOP_TIME;
  562. }
  563. ULONGLONG msProfCreateDestroyListbox(HDC hdc, ULONG Iter)
  564. {
  565.     HWND hwnd, hwndParent;
  566.     INIT_TIMER;
  567.     WNDCLASS wc;
  568.     wc.style            = 0;
  569.     wc.lpfnWndProc      = CreateDestroyWndProc;
  570.     wc.cbClsExtra       = 0;
  571.     wc.cbWndExtra       = 0;
  572.     wc.hInstance        = ghinst;
  573.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  574.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  575.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  576.     wc.lpszMenuName     = NULL;
  577.     wc.lpszClassName    = "CreateDestroyWindow";
  578.     if (!RegisterClass(&wc)) {
  579.         MessageBox(GetParent(ghwndMDIClient), "5RegisterClass call failed.",
  580.                 "ERROR!", MB_OK);
  581.         return (ULONGLONG)(0);
  582.     }
  583.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  584.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  585.             ghwndMDIClient, NULL, ghinst, NULL);
  586.     START_TIMER;
  587.     while (ix--)
  588.     {
  589.         hwnd = CreateWindow("ListBox", NULL, WS_CHILD | LBS_STANDARD | WS_VISIBLE,
  590.                 50, 50, 200, 250, hwndParent, NULL, ghinst, NULL);
  591.         if (hwnd == NULL) {
  592.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  593.                     "ERROR!", MB_OK);
  594.             return (ULONGLONG)(0);
  595.         }
  596.         DestroyWindow(hwnd);
  597.     }
  598.     END_TIMER_NO_RETURN;
  599.     DestroyWindow(hwndParent);
  600.     UnregisterClass("CreateDestroyWindow", ghinst);
  601.     RETURN_STOP_TIME;
  602. }
  603. ULONGLONG msProfCreateDestroyButton(HDC hdc, ULONG Iter)
  604. {
  605.     HWND hwnd, hwndParent;
  606.     INIT_TIMER;
  607.     WNDCLASS wc;
  608.     wc.style            = 0;
  609.     wc.lpfnWndProc      = CreateDestroyWndProc;
  610.     wc.cbClsExtra       = 0;
  611.     wc.cbWndExtra       = 0;
  612.     wc.hInstance        = ghinst;
  613.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  614.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  615.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  616.     wc.lpszMenuName     = NULL;
  617.     wc.lpszClassName    = "CreateDestroyWindow";
  618.     if (!RegisterClass(&wc)) {
  619.         MessageBox(GetParent(ghwndMDIClient), "6RegisterClass call failed.",
  620.                 "ERROR!", MB_OK);
  621.         return (ULONGLONG)(0);
  622.     }
  623.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  624.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  625.             ghwndMDIClient, NULL, ghinst, NULL);
  626.     START_TIMER;
  627.     while (ix--)
  628.     {
  629.         hwnd = CreateWindow("Button", "OK", WS_CHILD | BS_PUSHBUTTON,
  630.                 50, 50, 200, 250, hwndParent, NULL, ghinst, NULL);
  631.         if (hwnd == NULL) {
  632.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  633.                     "ERROR!", MB_OK);
  634.             return (ULONGLONG)(0);
  635.         }
  636.         DestroyWindow(hwnd);
  637.     }
  638.     END_TIMER_NO_RETURN;
  639.     DestroyWindow(hwndParent);
  640.     UnregisterClass("CreateDestroyWindow", ghinst);
  641.     RETURN_STOP_TIME;
  642. }
  643. ULONGLONG msProfCreateDestroyCombobox(HDC hdc, ULONG Iter)
  644. {
  645.     HWND hwnd, hwndParent;
  646.     INIT_TIMER;
  647.     WNDCLASS wc;
  648.     wc.style            = 0;
  649.     wc.lpfnWndProc      = CreateDestroyWndProc;
  650.     wc.cbClsExtra       = 0;
  651.     wc.cbWndExtra       = 0;
  652.     wc.hInstance        = ghinst;
  653.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  654.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  655.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  656.     wc.lpszMenuName     = NULL;
  657.     wc.lpszClassName    = "CreateDestroyWindow";
  658.     if (!RegisterClass(&wc)) {
  659.         MessageBox(GetParent(ghwndMDIClient), "7RegisterClass call failed.",
  660.                 "ERROR!", MB_OK);
  661.         return (ULONGLONG)(0);
  662.     }
  663.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  664.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  665.             ghwndMDIClient, NULL, ghinst, NULL);
  666.     START_TIMER;
  667.     while (ix--)
  668.     {
  669.         hwnd = CreateWindow("Combobox", NULL, WS_CHILD | CBS_SIMPLE | CBS_HASSTRINGS | WS_VISIBLE,
  670.                 50, 50, 200, 250, hwndParent, NULL, ghinst, NULL);
  671.         if (hwnd == NULL) {
  672.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  673.                     "ERROR!", MB_OK);
  674.             return (ULONGLONG)(0);
  675.         }
  676.         DestroyWindow(hwnd);
  677.     }
  678.     END_TIMER_NO_RETURN;
  679.     DestroyWindow(hwndParent);
  680.     UnregisterClass("CreateDestroyWindow", ghinst);
  681.     RETURN_STOP_TIME;
  682. }
  683. ULONGLONG msProfCreateDestroyEdit(HDC hdc, ULONG Iter)
  684. {
  685.     HWND hwnd, hwndParent;
  686.     INIT_TIMER;
  687.     WNDCLASS wc;
  688.     wc.style            = 0;
  689.     wc.lpfnWndProc      = CreateDestroyWndProc;
  690.     wc.cbClsExtra       = 0;
  691.     wc.cbWndExtra       = 0;
  692.     wc.hInstance        = ghinst;
  693.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  694.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  695.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  696.     wc.lpszMenuName     = NULL;
  697.     wc.lpszClassName    = "CreateDestroyWindow";
  698.     if (!RegisterClass(&wc)) {
  699.         MessageBox(GetParent(ghwndMDIClient), "8RegisterClass call failed.",
  700.                 "ERROR!", MB_OK);
  701.         return (ULONGLONG)(0);
  702.     }
  703.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  704.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  705.             ghwndMDIClient, NULL, ghinst, NULL);
  706.     START_TIMER;
  707.     while (ix--)
  708.     {
  709.         hwnd = CreateWindow("Edit", NULL, WS_CHILD | WS_VISIBLE,
  710.                 50, 50, 200, 250, hwndParent, NULL, ghinst, NULL);
  711.         if (hwnd == NULL) {
  712.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  713.                     "ERROR!", MB_OK);
  714.             return (ULONGLONG)(0);
  715.         }
  716.         DestroyWindow(hwnd);
  717.     }
  718.     END_TIMER_NO_RETURN;
  719.     DestroyWindow(hwndParent);
  720.     UnregisterClass("CreateDestroyWindow", ghinst);
  721.     RETURN_STOP_TIME;
  722. }
  723. ULONGLONG msProfCreateDestroyStatic(HDC hdc, ULONG Iter)
  724. {
  725.     HWND hwnd, hwndParent;
  726.     INIT_TIMER;
  727.     WNDCLASS wc;
  728.     wc.style            = 0;
  729.     wc.lpfnWndProc      = CreateDestroyWndProc;
  730.     wc.cbClsExtra       = 0;
  731.     wc.cbWndExtra       = 0;
  732.     wc.hInstance        = ghinst;
  733.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  734.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  735.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  736.     wc.lpszMenuName     = NULL;
  737.     wc.lpszClassName    = "CreateDestroyWindow";
  738.     if (!RegisterClass(&wc)) {
  739.         MessageBox(GetParent(ghwndMDIClient), "9RegisterClass call failed.",
  740.                 "ERROR!", MB_OK);
  741.         return (ULONGLONG)(0);
  742.     }
  743.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  744.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  745.             ghwndMDIClient, NULL, ghinst, NULL);
  746.     START_TIMER;
  747.     while (ix--)
  748.     {
  749.         hwnd = CreateWindow("Static", "Hello", WS_CHILD | SS_SIMPLE,
  750.                 50, 50, 200, 250, hwndParent, NULL, ghinst, NULL);
  751.         if (hwnd == NULL) {
  752.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  753.                     "ERROR!", MB_OK);
  754.             return (ULONGLONG)(0);
  755.         }
  756.         DestroyWindow(hwnd);
  757.     }
  758.     END_TIMER_NO_RETURN;
  759.     DestroyWindow(hwndParent);
  760.     UnregisterClass("CreateDestroyWindow", ghinst);
  761.     RETURN_STOP_TIME;
  762. }
  763. ULONGLONG msProfCreateDestroyScrollbar(HDC hdc, ULONG Iter)
  764. {
  765.     HWND hwnd, hwndParent;
  766.     INIT_TIMER;
  767.     WNDCLASS wc;
  768.     wc.style            = 0;
  769.     wc.lpfnWndProc      = CreateDestroyWndProc;
  770.     wc.cbClsExtra       = 0;
  771.     wc.cbWndExtra       = 0;
  772.     wc.hInstance        = ghinst;
  773.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  774.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  775.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  776.     wc.lpszMenuName     = NULL;
  777.     wc.lpszClassName    = "CreateDestroyWindow";
  778.     if (!RegisterClass(&wc)) {
  779.         MessageBox(GetParent(ghwndMDIClient), "10RegisterClass call failed.",
  780.                 "ERROR!", MB_OK);
  781.         return (ULONGLONG)(0);
  782.     }
  783.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  784.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  785.             ghwndMDIClient, NULL, ghinst, NULL);
  786.     START_TIMER;
  787.     while (ix--)
  788.     {
  789.         hwnd = CreateWindow("Scrollbar", "Hello", WS_CHILD | SBS_HORZ | SBS_TOPALIGN,
  790.                 50, 50, 100, 100, hwndParent, NULL, ghinst, NULL);
  791.         if (hwnd == NULL) {
  792.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  793.                     "ERROR!", MB_OK);
  794.             return (ULONGLONG)(0);
  795.         }
  796.         DestroyWindow(hwnd);
  797.     }
  798.     END_TIMER_NO_RETURN;
  799.     DestroyWindow(hwndParent);
  800.     UnregisterClass("CreateDestroyWindow", ghinst);
  801.     RETURN_STOP_TIME;
  802. }
  803. ULONGLONG msProfListboxInsert1(HDC hdc, ULONG Iter)
  804. {
  805.     ULONG i;
  806.     HWND hwndParent;
  807.     INIT_TIMER;
  808.     WNDCLASS wc;
  809.     HWND *ahwnd = LocalAlloc(LPTR,Iter*sizeof(HANDLE));
  810.     if(!ahwnd)
  811.        MessageBox(GetParent(ghwndMDIClient),
  812.         "Could not Allocate Memory for Handle Array",
  813.         "ERROR!", MB_OK);
  814.     wc.style            = 0;
  815.     wc.lpfnWndProc      = CreateDestroyWndProc;
  816.     wc.cbClsExtra       = 0;
  817.     wc.cbWndExtra       = 0;
  818.     wc.hInstance        = ghinst;
  819.     wc.hIcon            = LoadIcon(ghinst, IDUSERBENCH);
  820.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  821.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  822.     wc.lpszMenuName     = NULL;
  823.     wc.lpszClassName    = "CreateDestroyWindow";
  824.     if (!RegisterClass(&wc)) {
  825.         MessageBox(GetParent(ghwndMDIClient), "11RegisterClass call failed.",
  826.                 "ERROR!", MB_OK);
  827.         return (ULONGLONG)(0);
  828.     }
  829.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  830.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  831.             ghwndMDIClient, NULL, ghinst, NULL);
  832.     for (i=0; i < Iter; i++)
  833.     {
  834.         ahwnd[i] = CreateWindow("ListBox", NULL, WS_CHILD | LBS_STANDARD,
  835.                 50, 50, 200, 250, hwndParent, NULL, ghinst, NULL);
  836.         if (ahwnd[i] == NULL) {
  837.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  838.                     "ERROR!", MB_OK);
  839.             return (ULONGLONG)(0);
  840.         }
  841.     }
  842.     START_TIMER;
  843.     while (ix--)
  844.         for (i = 0; i < 200; i++)
  845.             SendMessage(ahwnd[ix], LB_ADDSTRING, 0, (LPARAM)aszTypical[i % NStrings]);
  846.     END_TIMER_NO_RETURN;
  847.     for (i = 0; i < Iter; i++)
  848.         DestroyWindow(ahwnd[i]);
  849.     DestroyWindow(hwndParent);
  850.     UnregisterClass("CreateDestroyWindow", ghinst);
  851.     LocalFree(ahwnd);
  852.     RETURN_STOP_TIME;
  853. }
  854. ULONGLONG msProfListboxInsert2(HDC hdc, ULONG Iter)
  855. {
  856.     ULONG i;
  857.     HWND hwndParent;
  858.     INIT_TIMER;
  859.     WNDCLASS wc;
  860.     HWND *ahwnd = LocalAlloc(LPTR,Iter*sizeof(HANDLE));
  861.     if(!ahwnd)
  862.        MessageBox(GetParent(ghwndMDIClient),
  863.         "Could not Allocate Memory for Handle Array",
  864.         "ERROR!", MB_OK);
  865.     wc.style            = 0;
  866.     wc.lpfnWndProc      = CreateDestroyWndProc;
  867.     wc.cbClsExtra       = 0;
  868.     wc.cbWndExtra       = 0;
  869.     wc.hInstance        = ghinst;
  870.     wc.hIcon            = LoadIcon(ghinst, IDUSERBENCH);
  871.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  872.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  873.     wc.lpszMenuName     = NULL;
  874.     wc.lpszClassName    = "CreateDestroyWindow";
  875.     if (!RegisterClass(&wc)) {
  876.         MessageBox(GetParent(ghwndMDIClient), "12RegisterClass call failed.",
  877.                 "ERROR!", MB_OK);
  878.         return (ULONGLONG)(0);
  879.     }
  880.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  881.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  882.             ghwndMDIClient, NULL, ghinst, NULL);
  883.     for (i = 0; i < Iter; i++) {
  884.         ahwnd[i] = CreateWindow("ListBox", NULL,
  885.                 WS_CHILD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS,
  886.                 50, 50, 200, 250, hwndParent, NULL, ghinst, NULL);
  887.         if (ahwnd[i] == NULL) {
  888.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  889.                     "ERROR!", MB_OK);
  890.             return (ULONGLONG)(0);
  891.         }
  892.     }
  893.     START_TIMER;
  894.     while (ix--)
  895.         for (i = 0; i < 200; i++)
  896.             SendMessage(ahwnd[ix], LB_ADDSTRING, 0, (LPARAM)aszTypical[i % NStrings]);
  897.     END_TIMER_NO_RETURN;
  898.     for (i = 0; i < Iter; i++)
  899.         DestroyWindow(ahwnd[i]);
  900.     DestroyWindow(hwndParent);
  901.     UnregisterClass("CreateDestroyWindow", ghinst);
  902.     LocalFree(ahwnd);
  903.     RETURN_STOP_TIME;
  904. }
  905. ULONGLONG msProfListboxInsert3(HDC hdc, ULONG Iter)
  906. {
  907.     ULONG i;
  908.     HWND hwndParent;
  909.     INIT_TIMER;
  910.     WNDCLASS wc;
  911.     HWND *ahwnd = LocalAlloc(LPTR,Iter*sizeof(HANDLE));
  912.     if(!ahwnd)
  913.        MessageBox(GetParent(ghwndMDIClient),
  914.         "Could not Allocate Memory for Handle Array",
  915.         "ERROR!", MB_OK);
  916.     wc.style            = 0;
  917.     wc.lpfnWndProc      = CreateDestroyWndProc;
  918.     wc.cbClsExtra       = 0;
  919.     wc.cbWndExtra       = 0;
  920.     wc.hInstance        = ghinst;
  921.     wc.hIcon            = LoadIcon(ghinst, IDUSERBENCH);
  922.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  923.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  924.     wc.lpszMenuName     = NULL;
  925.     wc.lpszClassName    = "CreateDestroyWindow";
  926.     if (!RegisterClass(&wc)) {
  927.         MessageBox(GetParent(ghwndMDIClient), "13RegisterClass call failed.",
  928.                 "ERROR!", MB_OK);
  929.         return (ULONGLONG)(0);
  930.     }
  931.     hwndParent = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  932.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  933.             ghwndMDIClient, NULL, ghinst, NULL);
  934.     for (i = 0; i < Iter; i++) {
  935.         ahwnd[i] = CreateWindow("ListBox", NULL,
  936.                 WS_CHILD | LBS_SORT | LBS_OWNERDRAWFIXED,
  937.                 50, 50, 200, 250, hwndParent, NULL, ghinst, NULL);
  938.         if (ahwnd[i] == NULL) {
  939.             MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  940.                     "ERROR!", MB_OK);
  941.             return (ULONGLONG)(0);
  942.         }
  943.     }
  944.     START_TIMER;
  945.     while (ix--)
  946.         for (i = 0; i < 200; i++)
  947.             SendMessage(ahwnd[ix], LB_ADDSTRING, 0, (LPARAM)aszTypical[i % NStrings]);
  948.     END_TIMER_NO_RETURN;
  949.     for (i = 0; i < Iter; i++)
  950.         DestroyWindow(ahwnd[i]);
  951.     DestroyWindow(hwndParent);
  952.     UnregisterClass("CreateDestroyWindow", ghinst);
  953.     LocalFree(ahwnd);
  954.     RETURN_STOP_TIME;
  955. }
  956. /*
  957.  * Mostly stolen from pbrush.
  958.  */
  959. INT_PTR APIENTRY ClearDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  960. {
  961.     static BOOL bChangeOk = TRUE;
  962.     HDC dc;
  963.     INT wid, hgt, numcolors;
  964.     switch (message) {
  965.     case WM_INITDIALOG:
  966.         /*
  967.          * standard init stuff for pbrush
  968.          */
  969.         dc = GetDC(NULL);
  970.         numcolors = GetDeviceCaps(dc, NUMCOLORS);
  971.         ReleaseDC(NULL, dc);
  972.         dc = GetDC(NULL);
  973.         wid = GetDeviceCaps(dc, HORZRES);
  974.         hgt = GetDeviceCaps(dc, VERTRES);
  975.         ReleaseDC(NULL, dc);
  976.         CheckRadioButton (hDlg, ID2, ID256, ID2);
  977.         EnableWindow(GetDlgItem(hDlg, ID256), FALSE);
  978.         CheckRadioButton(hDlg, ID2, ID256, ID256);
  979.         CheckRadioButton(hDlg, ID2, ID256, ID2);
  980.         EnableWindow(GetDlgItem(hDlg, ID256), FALSE);
  981.         CheckRadioButton(hDlg, ID2, ID256, ID256);
  982.         SetDlgItemInt(hDlg, IDWIDTH, 0, FALSE);
  983.         SetDlgItemInt(hDlg, IDHEIGHT, 0, FALSE);
  984.         CheckRadioButton(hDlg, IDIN, IDPELS, TRUE);
  985.         if (!gfSetFocus)
  986.             return FALSE;
  987.         break;
  988.     default:
  989.         return FALSE;
  990.     }
  991.     return TRUE;
  992. }
  993. INT_PTR APIENTRY ClearDlgNoState(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  994. {
  995.     static BOOL bChangeOk = TRUE;
  996.     HDC dc;
  997.     INT wid, hgt, numcolors;
  998.     switch (message) {
  999.     case WM_INITDIALOG:
  1000.         if (!gfSetFocus)
  1001.             return FALSE;
  1002.         break;
  1003.     default:
  1004.         return FALSE;
  1005.     }
  1006.     return TRUE;
  1007. }
  1008. ULONGLONG msProfSize(HDC hdc, ULONG Iter)
  1009. {
  1010.     HWND hwnd;
  1011.     RECT rc;
  1012.     INIT_TIMER;
  1013.     GetClientRect(ghwndMDIClient, (LPRECT)&rc);
  1014.     InflateRect((LPRECT)&rc, -10, -10);
  1015.     hwnd = GetWindow(ghwndMDIClient, GW_CHILD);
  1016.     ShowWindow(hwnd, SW_RESTORE);
  1017.     ShowWindow(hwnd, FALSE);
  1018.     UpdateWindow(hwnd);
  1019.     /* time start */
  1020.     START_TIMER;
  1021.     while (ix--)
  1022.     {
  1023.         SetWindowPos(hwnd, NULL, rc.left, rc.top,
  1024.                 rc.right - rc.left, rc.bottom - rc.top,
  1025.                 SWP_NOZORDER | SWP_NOACTIVATE);
  1026.         SetWindowPos(hwnd, NULL, rc.left, rc.top,
  1027.                 (rc.right - rc.left) / 2, (rc.bottom - rc.top) / 2,
  1028.                 SWP_NOZORDER | SWP_NOACTIVATE);
  1029.     }
  1030.     /* time end */
  1031.     END_TIMER_NO_RETURN;
  1032.     ShowWindow(hwnd, SW_RESTORE);
  1033.     RETURN_STOP_TIME;
  1034. }
  1035. ULONGLONG msProfMove(HDC hdc, ULONG Iter)
  1036. {
  1037.     HWND hwnd;
  1038.     RECT rc;
  1039.     INIT_TIMER;
  1040.     GetClientRect(ghwndMDIClient, (LPRECT)&rc);
  1041.     InflateRect((LPRECT)&rc, -(rc.right - rc.left) / 4,
  1042.             -(rc.bottom - rc.top) / 4);
  1043.     hwnd = GetWindow(ghwndMDIClient, GW_CHILD);
  1044.     ShowWindow(hwnd, SW_RESTORE);
  1045.     ShowWindow(hwnd, FALSE);
  1046.     UpdateWindow(hwnd);
  1047.     /* time start */
  1048.     START_TIMER;
  1049.     while (ix--)
  1050.     {
  1051.         SetWindowPos(hwnd, NULL, rc.left, rc.top,
  1052.                 rc.right - rc.left, rc.bottom - rc.top,
  1053.                 SWP_NOZORDER | SWP_NOACTIVATE);
  1054.         SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
  1055.                 SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
  1056.     }
  1057.     /* time end */
  1058.     END_TIMER_NO_RETURN;
  1059.     ShowWindow(hwnd, SW_RESTORE);
  1060.     RETURN_STOP_TIME;
  1061. }
  1062. #define WM_SYSTIMER 0x0118
  1063. ULONGLONG msProfMenu(HDC hdc, ULONG Iter)
  1064. {
  1065.     MSG msg;
  1066.     INIT_TIMER;
  1067.     HWND hwnd = GetParent(ghwndMDIClient);
  1068.     ShowWindow(hwnd, FALSE);
  1069.     /*
  1070.      * Multipad's edit menu is a great choice. Multipad does a goodly lot
  1071.      * of WM_INITMENU time initialization. The WM_SYSTIMER message is
  1072.      * to circumvent menu type ahead so the menu actually shows.
  1073.      */
  1074.     START_TIMER;
  1075.     while (ix--)
  1076.     {
  1077.         PostMessage(hwnd, WM_KEYDOWN, VK_ESCAPE, 0L);
  1078.         PostMessage(hwnd, WM_KEYDOWN, VK_ESCAPE, 0L);
  1079.         PostMessage(hwnd, WM_SYSTIMER, 0, 0L);
  1080.         SendMessage(hwnd, WM_SYSCOMMAND, SC_KEYMENU, (DWORD)(WORD)'e');
  1081.         while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
  1082.             DispatchMessage(&msg);
  1083.     }
  1084.     END_TIMER_NO_RETURN;
  1085.     ShowWindow(hwnd, SW_RESTORE);
  1086.     UpdateWindow(hwnd);
  1087.     RETURN_STOP_TIME;
  1088. }
  1089. ULONGLONG msProfGetClientRect(HDC hdc, ULONG Iter)
  1090. {
  1091.     RECT rc;
  1092.     INIT_TIMER;
  1093.     START_TIMER;
  1094.     while (ix--)
  1095.     {
  1096.         GetClientRect(ghwndMDIClient, &rc);
  1097.     }
  1098.     END_TIMER;
  1099. }
  1100. ULONGLONG msProfScreenToClient(HDC hdc, ULONG Iter)
  1101. {
  1102.     POINT pt;
  1103.     INIT_TIMER;
  1104.     pt.x = 100;
  1105.     pt.y = 200;
  1106.     START_TIMER;
  1107.     while (ix--)
  1108.     {
  1109.         ScreenToClient(ghwndMDIClient, &pt);
  1110.     }
  1111.     END_TIMER;
  1112. }
  1113. ULONGLONG msProfGetInputState(HDC hdc, ULONG Iter)
  1114. {
  1115.     INIT_TIMER;
  1116.     START_TIMER;
  1117.     while (ix--)
  1118.     {
  1119.         GetInputState();
  1120.     }
  1121.     END_TIMER;
  1122. }
  1123. ULONGLONG msProfGetKeyState(HDC hdc, ULONG Iter)
  1124. {
  1125.     INIT_TIMER;
  1126.     START_TIMER;
  1127.     while (ix--)
  1128.     {
  1129.         GetKeyState(VK_ESCAPE);
  1130.     }
  1131.     END_TIMER;
  1132. }
  1133. ULONGLONG msProfGetAsyncKeyState(HDC hdc, ULONG Iter)
  1134. {
  1135.     INIT_TIMER;
  1136.     START_TIMER;
  1137.     while (ix--)
  1138.     {
  1139.         GetAsyncKeyState(VK_ESCAPE);
  1140.     }
  1141.     END_TIMER;
  1142. }
  1143. ULONGLONG msProfDispatchMessage(HDC hdc, ULONG Iter)
  1144. {
  1145.     HWND hwnd;
  1146.     MSG msg;
  1147.     INIT_TIMER;
  1148.     WNDCLASS wc;
  1149.     wc.style            = 0;
  1150.     wc.lpfnWndProc      = CreateDestroyWndProc;
  1151.     wc.cbClsExtra       = 0;
  1152.     wc.cbWndExtra       = 0;
  1153.     wc.hInstance        = ghinst;
  1154.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  1155.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  1156.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  1157.     wc.lpszMenuName     = NULL;
  1158.     wc.lpszClassName    = "CreateDestroyWindow";
  1159.     if (!RegisterClass(&wc)) {
  1160.         MessageBox(GetParent(ghwndMDIClient), "14RegisterClass call failed.",
  1161.                 "ERROR!", MB_OK);
  1162.         return (ULONGLONG)(0);
  1163.     }
  1164.     hwnd = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  1165.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  1166.             ghwndMDIClient, NULL, ghinst, NULL);
  1167.     msg.hwnd = hwnd;
  1168.     msg.message = WM_MOUSEMOVE;
  1169.     msg.wParam = 1;
  1170.     msg.lParam = 2;
  1171.     msg.time = 3;
  1172.     msg.pt.x = 4;
  1173.     msg.pt.y = 5;
  1174.     START_TIMER;
  1175.     while (ix--)
  1176.     {
  1177.         DispatchMessage(&msg);
  1178.     }
  1179.     END_TIMER_NO_RETURN;
  1180.     DestroyWindow(hwnd);
  1181.     UnregisterClass("CreateDestroyWindow", ghinst);
  1182.     RETURN_STOP_TIME;
  1183. }
  1184. ULONGLONG msProfCallback(HDC hdc, ULONG Iter)
  1185. {
  1186.     HWND hwnd;
  1187.     INIT_TIMER;
  1188.     WNDCLASSW wc;
  1189.     wc.style            = 0;
  1190.     wc.lpfnWndProc      = CreateDestroyWndProcW;
  1191.     wc.cbClsExtra       = 0;
  1192.     wc.cbWndExtra       = 0;
  1193.     wc.hInstance        = ghinst;
  1194.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  1195.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  1196.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  1197.     wc.lpszMenuName     = NULL;
  1198.     wc.lpszClassName    = L"CreateDestroyWindow";
  1199.     if (!RegisterClassW(&wc)) {
  1200. // Fails On Chicago
  1201. //        MessageBox(GetParent(ghwndMDIClient), "15RegisterClass call failed.",
  1202. //                "ERROR!", MB_OK);
  1203.         return (ULONGLONG)(0);
  1204.     }
  1205.     hwnd = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  1206.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  1207.             ghwndMDIClient, NULL, ghinst, NULL);
  1208.     START_TIMER;
  1209.     while (ix--)
  1210.     {
  1211.         SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0);
  1212.     }
  1213.     END_TIMER_NO_RETURN;
  1214.     DestroyWindow(hwnd);
  1215.     UnregisterClass("CreateDestroyWindow", ghinst);
  1216.     RETURN_STOP_TIME;
  1217. }
  1218. ULONGLONG msProfSendMessage(HDC hdc, ULONG Iter)
  1219. {
  1220.     HWND hwnd;
  1221.     INIT_TIMER;
  1222.     WNDCLASS wc;
  1223.     wc.style            = 0;
  1224.     wc.lpfnWndProc      = CreateDestroyWndProc;
  1225.     wc.cbClsExtra       = 0;
  1226.     wc.cbWndExtra       = 0;
  1227.     wc.hInstance        = ghinst;
  1228.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  1229.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  1230.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  1231.     wc.lpszMenuName     = NULL;
  1232.     wc.lpszClassName    = "CreateDestroyWindow";
  1233.     if (!RegisterClass(&wc)) {
  1234.         MessageBox(GetParent(ghwndMDIClient), "16RegisterClass call failed.",
  1235.                 "ERROR!", MB_OK);
  1236.         return (ULONGLONG)(0);
  1237.     }
  1238.     hwnd = CreateWindow("CreateDestroyWindow", NULL, WS_CHILD,
  1239.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  1240.             ghwndMDIClient, NULL, ghinst, NULL);
  1241.     START_TIMER;
  1242.     while (ix--)
  1243.     {
  1244.         SendMessage(hwnd, WM_MOUSEMOVE, 1, 2);
  1245.     }
  1246.     END_TIMER_NO_RETURN;
  1247.     DestroyWindow(hwnd);
  1248.     UnregisterClass("CreateDestroyWindow", ghinst);
  1249.     RETURN_STOP_TIME;
  1250. }
  1251. HWND hwndShare;
  1252. DWORD SendMessageDiffThreadFunc(PVOID pdwData)
  1253. {
  1254.     WNDCLASS wc;
  1255.     MSG msg;
  1256.     BOOL b;
  1257.     wc.style            = 0;
  1258.     wc.lpfnWndProc      = CreateDestroyWndProc;
  1259.     wc.cbClsExtra       = 0;
  1260.     wc.cbWndExtra       = 0;
  1261.     wc.hInstance        = ghinst;
  1262.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  1263.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  1264.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  1265.     wc.lpszMenuName     = NULL;
  1266.     wc.lpszClassName    = "SendMessageDiffThread";
  1267.     if (!RegisterClass(&wc)) {
  1268.         MessageBox(GetParent(ghwndMDIClient), "19RegisterClass call failed.",
  1269.                 "ERROR!", MB_OK);
  1270.         return FALSE;
  1271.     }
  1272.     hwndShare = CreateWindow("SendMessageDiffThread", NULL, 0,
  1273.             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  1274.             GetDesktopWindow(), NULL, ghinst, NULL);
  1275.     ASSERT(hwndShare);
  1276.     SetEvent(*((PHANDLE)pdwData));
  1277.     while (GetMessage(&msg, NULL, 0, 0)) {
  1278.         DispatchMessage(&msg);
  1279.     }
  1280.     b = DestroyWindow(hwndShare);
  1281.     ASSERT(b);
  1282.     b = UnregisterClass("SendMessageDiffThread", ghinst);
  1283.     ASSERT(b);
  1284.     return TRUE;
  1285. }
  1286. ULONGLONG msProfSendMessageDiffThread(HDC hdc, ULONG Iter)
  1287. {
  1288.     DWORD dwData;
  1289.     DWORD id;
  1290.     HANDLE hEvent;
  1291.     HANDLE hThread;
  1292.     INIT_TIMER;
  1293.     hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
  1294.     hwndShare = (HWND)0;
  1295.     hThread = CreateThread( NULL, 0, SendMessageDiffThreadFunc, &hEvent, 0, &id);
  1296.     WaitForSingleObject( hEvent, 20*1000);
  1297.     Sleep(10*1000);
  1298.     ASSERT(hwndShare);
  1299.     START_TIMER;
  1300.     while (ix--)
  1301.     {
  1302.         SendMessage(hwndShare, WM_MOUSEMOVE, 1, 2);
  1303.     }
  1304.     END_TIMER_NO_RETURN;
  1305.     PostThreadMessage(id, WM_QUIT, 0, 0);
  1306.     WaitForSingleObject(hThread, 2*1000); // Wait for Cleanup before Starting Next Cycle
  1307.     CloseHandle(hThread);
  1308.     RETURN_STOP_TIME;
  1309. }
  1310. ULONGLONG msProfUpdateWindow(HDC hDC, ULONG Iter)
  1311. {
  1312.     WNDCLASS wc;
  1313.     HWND hwnd;
  1314.     RECT rect;
  1315.     static LPCSTR className = "UpdateWindowTest";
  1316.     INIT_TIMER;
  1317.     wc.style            = 0;
  1318.     wc.lpfnWndProc      = CreateDestroyWndProc;
  1319.     wc.cbClsExtra       = 0;
  1320.     wc.cbWndExtra       = 0;
  1321.     wc.hInstance        = ghinst;
  1322.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  1323.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  1324.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  1325.     wc.lpszMenuName     = NULL;
  1326.     wc.lpszClassName    = className;
  1327.     if (!RegisterClass(&wc)) {
  1328.         MessageBox(GetParent(ghwndMDIClient), "RegisterClass call failed.",
  1329.                 "ERROR!", MB_OK);
  1330.         return FALSE;
  1331.     }
  1332.     hwnd = CreateWindow(className, NULL,
  1333.         WS_OVERLAPPEDWINDOW,
  1334.         CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  1335.         NULL, NULL, ghinst, NULL);
  1336.     if (hwnd == NULL) {
  1337.         MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  1338.             "ERROR!", MB_OK);
  1339.             return 0;
  1340.     }
  1341.     GetClientRect(hwnd, &rect);
  1342.     START_TIMER;
  1343.     while (ix--) {
  1344.         START_OVERHEAD;
  1345.         InvalidateRect(hwnd, &rect, FALSE);
  1346.         END_OVERHEAD;
  1347.         UpdateWindow(hwnd);
  1348.     }
  1349.     END_TIMER_NO_RETURN;
  1350.     DestroyWindow(hwnd);
  1351.     UnregisterClass(className, ghinst);
  1352.     RETURN_STOP_TIME;
  1353. }
  1354. ULONGLONG msProfTranslateMessage(HDC hDC, ULONG Iter)
  1355. {
  1356.     WNDCLASS wc;
  1357.     HWND hwnd;
  1358.     RECT rect;
  1359.     static LPCSTR className = "TranslateMessageTest";
  1360.     static MSG msgTemplate = {
  1361.         (HWND)NULL, WM_KEYDOWN,
  1362.         (WPARAM)0,
  1363.         (LPARAM)0,
  1364.         0,  // time
  1365.         {0, 0}, // mouse pointer
  1366.     };
  1367.     INIT_TIMER;
  1368.     wc.style            = 0;
  1369.     wc.lpfnWndProc      = CreateDestroyWndProc;
  1370.     wc.cbClsExtra       = 0;
  1371.     wc.cbWndExtra       = 0;
  1372.     wc.hInstance        = ghinst;
  1373.     wc.hIcon            = LoadIcon(ghinst, (LPSTR)IDUSERBENCH);
  1374.     wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
  1375.     wc.hbrBackground    = (HBRUSH)(COLOR_APPWORKSPACE + 1);
  1376.     wc.lpszMenuName     = NULL;
  1377.     wc.lpszClassName    = className;
  1378.     if (!RegisterClass(&wc)) {
  1379.         MessageBox(GetParent(ghwndMDIClient), "RegisterClass call failed.",
  1380.                 "ERROR!", MB_OK);
  1381.         return FALSE;
  1382.     }
  1383.     hwnd = CreateWindow(className, NULL,
  1384.         WS_OVERLAPPEDWINDOW,
  1385.         CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
  1386.         NULL, NULL, ghinst, NULL);
  1387.     if (hwnd == NULL) {
  1388.         MessageBox(GetParent(ghwndMDIClient), "CreateWindow call failed.",
  1389.             "ERROR!", MB_OK);
  1390.             return 0;
  1391.     }
  1392.     msgTemplate.hwnd = hwnd;
  1393.     START_TIMER;
  1394.     while (ix--) {
  1395.         MSG msg = msgTemplate;
  1396.         TranslateMessage(&msg);
  1397.     }
  1398.     DestroyWindow(hwnd);
  1399.     UnregisterClass(className, ghinst);
  1400.     END_TIMER;
  1401. }
  1402. #define WIDE    1
  1403. #include "awtest.inc"
  1404. #undef WIDE
  1405. #include "awtest.inc"
  1406. #define A1  A
  1407. #define A2  A
  1408. #include "abtest.inc"
  1409. #define A1  A
  1410. #define A2  W
  1411. #include "abtest.inc"
  1412. #define A1  W
  1413. #define A2  A
  1414. #include "abtest.inc"
  1415. #define A1  W
  1416. #define A2  W
  1417. #include "abtest.inc"
  1418. /*********************************************************************/
  1419. #define TEST_DEFAULT 300
  1420. TEST_ENTRY  gTestEntry[] = {
  1421.     (PUCHAR)"AvgDialog draw",(PFN_MS)msProfAvgDlgDraw, 10, 0 ,
  1422.     (PUCHAR)"AvgDialog create/draw/destroy",(PFN_MS)msProfAvgDlgCreate, 10, 0 ,
  1423.     (PUCHAR)"AvgDialog create/destroy",(PFN_MS)msProfAvgDlgCreateDestroy, 100, 0 ,
  1424.     (PUCHAR)"AvgDialog(no font) create/destroy",(PFN_MS)msProfAvgDlgCreateDestroyNoFont, 100, 0 ,
  1425.     (PUCHAR)"AvgDialog(no menu) create/destroy",(PFN_MS)msProfAvgDlgCreateDestroyNoMenu, 100, 0 ,
  1426.     (PUCHAR)"AvgDialog(empty) create/destroy",(PFN_MS)msProfAvgDlgCreateDestroyEmpty, 200, 0 ,
  1427.     (PUCHAR)"SizeWindow",(PFN_MS)msProfSize, 200, 0 ,
  1428.     (PUCHAR)"MoveWindow",(PFN_MS)msProfMove, 2000, 0 ,
  1429.     (PUCHAR)"Create/DestroyWindow (top)",(PFN_MS)msProfCreateDestroyWindow, 1000, 0 ,
  1430.     (PUCHAR)"Create/DestroyWindow (child)",(PFN_MS)msProfCreateDestroyChildWindow, 1000, 0 ,
  1431.     (PUCHAR)"Create/Destroy Listbox",(PFN_MS)msProfCreateDestroyListbox, 1000, 0 ,
  1432.     (PUCHAR)"Create/Destroy Button",(PFN_MS)msProfCreateDestroyButton, 1000, 0 ,
  1433.     (PUCHAR)"Create/Destroy Combobox",(PFN_MS)msProfCreateDestroyCombobox, 1000, 0 ,
  1434.     (PUCHAR)"Create/Destroy Edit",(PFN_MS)msProfCreateDestroyEdit, 1000, 0 ,
  1435.     (PUCHAR)"Create/Destroy Static",(PFN_MS)msProfCreateDestroyStatic, 1000, 0 ,
  1436.     (PUCHAR)"Create/Destroy Scrollbar",(PFN_MS)msProfCreateDestroyScrollbar, 1000, 0 ,
  1437.     (PUCHAR)"SendMessage w/callback",(PFN_MS)msProfCallback, 4000, 0 ,
  1438.     (PUCHAR)"SendMessage",(PFN_MS)msProfSendMessage, 4000, 0 ,
  1439.     (PUCHAR)"SendMessage Ansi->Ansi text",(PFN_MS)msProfSendMessageAA, 4000, 0 ,
  1440.     (PUCHAR)"SendMessage Ansi->Unicode text",(PFN_MS)msProfSendMessageAW, 4000, 0 ,
  1441.     (PUCHAR)"SendMessage Unicode->Ansi text", (PFN_MS)msProfSendMessageWA, 4000, 0,
  1442.     (PUCHAR)"SendMessage Unicode->Unicode text", (PFN_MS)msProfSendMessageWW, 4000, 0,
  1443.     (PUCHAR)"SendMessage - DiffThread",(PFN_MS)msProfSendMessageDiffThread, 1000, 0 ,
  1444.     (PUCHAR)"SetWindowLong",(PFN_MS)msProfSetWindowLong, 400, 0 ,
  1445.     (PUCHAR)"GetWindowLong",(PFN_MS)msProfGetWindowLong, 2000, 0 ,
  1446.     (PUCHAR)"PeekMessageA",(PFN_MS)msProfPeekMessageA, 1000, 0 ,
  1447.     (PUCHAR)"PeekMessageW",(PFN_MS)msProfPeekMessageW, 1000, 0 ,
  1448.     (PUCHAR)"DispatchMessageA",(PFN_MS)msProfDispatchMessageA, 4000, 0 ,
  1449.     (PUCHAR)"DispatchMessageW",(PFN_MS)msProfDispatchMessageW, 4000, 0 ,
  1450.     (PUCHAR)"LocalAlloc/Free",(PFN_MS)msProfLocalAllocFree, 2000, 0 ,
  1451.     (PUCHAR)"200 Listbox Insert",(PFN_MS)msProfListboxInsert1, 20, 0 ,
  1452.     (PUCHAR)"200 Listbox Insert (ownerdraw)",(PFN_MS)msProfListboxInsert2, 20, 0 ,
  1453.     (PUCHAR)"200 Listbox Insert (ownerdraw/sorted)",(PFN_MS)msProfListboxInsert3, 20, 0 ,
  1454.     (PUCHAR)"GetClientRect",(PFN_MS)msProfGetClientRect, 8000, 0 ,
  1455.     (PUCHAR)"ScreenToClient",(PFN_MS)msProfScreenToClient, 8000, 0 ,
  1456.     (PUCHAR)"GetInputState",(PFN_MS)msProfGetInputState, 2000, 0 ,
  1457.     (PUCHAR)"GetKeyState",(PFN_MS)msProfGetKeyState, 2000, 0 ,
  1458.     (PUCHAR)"GetAsyncKeyState",(PFN_MS)msProfGetAsyncKeyState, 8000, 0 ,
  1459.     (PUCHAR)"Register|UnregisterClass",(PFN_MS)msProfRegisterClass, 500, 0 ,
  1460.     (PUCHAR)"GetClassInfo|Name|Long|SetClassLong",(PFN_MS)msProfClassGroup, 500, 0 ,
  1461.     (PUCHAR)"Menu pulldown",(PFN_MS)msProfMenu, 2000, 0 ,
  1462.     (PUCHAR)"Open|Empty|Set|Get|CloseClipboard",(PFN_MS)msProfClipboardGroup, 1000, 0 ,
  1463.     (PUCHAR)"GetWindowTextLengthA",(PFN_MS)msProfGetWindowTextLengthA, 10000, 0,
  1464.     (PUCHAR)"GetWindowTextLengthW",(PFN_MS)msProfGetWindowTextLengthW, 10000, 0,
  1465.     (PUCHAR)"UdpateWindow",(PFN_MS)msProfUpdateWindow, 10000, 0,
  1466.     (PUCHAR)"TranslateMessage", (PFN_MS)msProfTranslateMessage, 10000, 0,
  1467.     (PUCHAR)"IsCharUpperA", (PFN_MS)msProfCharUpperA, 2000, 0,
  1468.     (PUCHAR)"IsCharLowerA", (PFN_MS)msProfCharLowerA, 2000, 0,
  1469.     (PUCHAR)"IsCharUpperW", (PFN_MS)msProfCharUpperW, 2000, 0,
  1470.     (PUCHAR)"IsCharLowerW", (PFN_MS)msProfCharLowerW, 2000, 0,
  1471.     (PUCHAR)"CharNextA", (PFN_MS)msProfCharNextA, 2000, 0,
  1472.     (PUCHAR)"CharNextW", (PFN_MS)msProfCharNextW, 2000, 0,
  1473.     (PUCHAR)"GetMessageW", (PFN_MS)msProfGetMessageW, 5000, 0,
  1474.     (PUCHAR)"GetMessageA", (PFN_MS)msProfGetMessageA, 5000, 0,
  1475. // Add New Tests Here
  1476. };
  1477. ULONG gNumTests = sizeof gTestEntry / sizeof gTestEntry[0]; //Total No. of Tests
  1478. ULONG gNumQTests = 10;// No. of tests in Group 1 (starting from first in the list)