Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.4 KiB

  1. //------------------------------------------------------------------------
  2. //
  3. // File: shell\themes\test\ctlperf\CtlPerf.cpp
  4. //
  5. // Contents: Main source file for CtlPerf.exe
  6. // This file was generated by the WTL app wizard.
  7. //
  8. // Classes: None
  9. //
  10. //------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #include <atlframe.h>
  13. #include "resource.h"
  14. #include "CtlPerfView.h"
  15. #include "aboutdlg.h"
  16. #include "MainFrm.h"
  17. CAppModule _Module;
  18. //------------------------------------------------------------------------
  19. //
  20. // Function: Run
  21. //
  22. // Synopsis: Create main window and start message loop
  23. //
  24. //------------------------------------------------------------------------
  25. int Run(LPTSTR lpstrCmdLine = NULL, int /*nCmdShow*/ = SW_SHOWDEFAULT)
  26. {
  27. CMessageLoop theLoop;
  28. _Module.AddMessageLoop(&theLoop);
  29. CMainFrame wndMain;
  30. if(wndMain.CreateEx() == NULL)
  31. {
  32. ATLTRACE(_T("Main window creation failed!\n"));
  33. return 0;
  34. }
  35. wndMain.ShowWindow(SW_MAXIMIZE);
  36. //** Parse command line
  37. if (lpstrCmdLine)
  38. {
  39. ::CharLower(lpstrCmdLine);
  40. LPTSTR p = _tcsstr(lpstrCmdLine, _T("/l"));
  41. TCHAR pszLogFileName[_MAX_PATH + 1];
  42. if(p) // Copy the log file name
  43. {
  44. _tcscpy(pszLogFileName, p + 2);
  45. p = pszLogFileName;
  46. while (*p && *p != _T(' '))
  47. {
  48. p++;
  49. }
  50. if (*p)
  51. {
  52. *p = _T('\0');
  53. }
  54. }
  55. // We communicate by messages with the main frame (the only thing we know from here)
  56. // that will forward to the view
  57. if (_tcsstr(lpstrCmdLine, _T("1pass")))
  58. {
  59. wndMain.PostMessage(WM_COMMAND, IDM_BATCH1, p ? (LPARAM) pszLogFileName : 0);
  60. }
  61. else if (_tcsstr(lpstrCmdLine, _T("2pass")))
  62. {
  63. if(_tcsstr(lpstrCmdLine, _T("/s")))
  64. {
  65. wndMain.PostMessage(WM_COMMAND, IDM_BATCH3, p ? (LPARAM) pszLogFileName : 0);
  66. }
  67. else
  68. {
  69. wndMain.PostMessage(WM_COMMAND, IDM_BATCH2, p ? (LPARAM) pszLogFileName : 0);
  70. }
  71. }
  72. }
  73. int nRet = theLoop.Run();
  74. _Module.RemoveMessageLoop();
  75. return nRet;
  76. }
  77. //------------------------------------------------------------------------
  78. //
  79. // Function: _tWinMain
  80. //
  81. // Synopsis: Main entry point
  82. //
  83. //------------------------------------------------------------------------
  84. int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
  85. {
  86. HRESULT hRes = ::CoInitialize(NULL);
  87. // If you are running on NT 4.0 or higher you can use the following call instead to
  88. // make the EXE free threaded. This means that calls come in on a random RPC thread.
  89. // HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
  90. ATLASSERT(SUCCEEDED(hRes));
  91. #if (_WIN32_IE >= 0x0300)
  92. INITCOMMONCONTROLSEX iccx;
  93. iccx.dwSize = sizeof(iccx);
  94. //iccx.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
  95. iccx.dwICC = 0x3FFF;
  96. BOOL bRet = ::InitCommonControlsEx(&iccx);
  97. bRet;
  98. ATLASSERT(bRet);
  99. #else
  100. ::InitCommonControls();
  101. #endif
  102. hRes = _Module.Init(NULL, hInstance);
  103. ATLASSERT(SUCCEEDED(hRes));
  104. int nRet = Run(lpstrCmdLine, nCmdShow);
  105. _Module.Term();
  106. ::CoUninitialize();
  107. return nRet;
  108. }