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.

166 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. MessagePage.cpp
  5. Abstract:
  6. WinMain function of "TsVer.exe".
  7. Author:
  8. Sergey Kuzin (a-skuzin@microsoft.com) 09-August-1999
  9. Environment:
  10. Revision History:
  11. --*/
  12. #include "tsverui.h"
  13. #include "resource.h"
  14. HINSTANCE g_hInst;
  15. TCHAR szKeyPath[MAX_LEN];
  16. TCHAR szConstraintsKeyPath[MAX_LEN];
  17. INT_PTR CALLBACK StartPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  18. INT_PTR CALLBACK CheckingPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  19. INT_PTR CALLBACK ConstraintsPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  20. INT_PTR CALLBACK MessagePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  21. INT_PTR CALLBACK FinishPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  22. ///////////////////////////////////////////////////////////////////////////////
  23. #ifdef _DEBUG
  24. #include <crtdbg.h>
  25. #endif _DEBUG
  26. int WINAPI WinMain (HINSTANCE hinstExe, HINSTANCE hinstPrev,
  27. LPSTR pszCmdLine, int nCmdShow)
  28. {
  29. #ifdef _DEBUG
  30. //detecting memory leaks
  31. // Get current flag
  32. int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
  33. // Turn on leak-checking bit
  34. tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
  35. // Set flag to the new value
  36. _CrtSetDbgFlag( tmpFlag );
  37. #endif _DEBUG
  38. g_hInst = hinstExe;
  39. LoadString (g_hInst, IDS_WINLOGON_KEY_PATH,
  40. szKeyPath, sizeof (szKeyPath)/sizeof(TCHAR));
  41. LoadString (g_hInst, IDS_CONSTRAINTS_KEY_PATH,
  42. szConstraintsKeyPath, sizeof (szConstraintsKeyPath)/sizeof(TCHAR));
  43. SHAREDWIZDATA wizdata;
  44. ZeroMemory(&wizdata,sizeof(SHAREDWIZDATA));
  45. PROPSHEETPAGE psp[5];
  46. ZeroMemory(psp,sizeof(psp));
  47. psp[0].dwSize=sizeof(PROPSHEETPAGE);
  48. psp[0].dwFlags= PSP_HIDEHEADER ;
  49. psp[0].hInstance=hinstExe;
  50. psp[0].pszTemplate=MAKEINTRESOURCE(IDD_START);
  51. psp[0].pfnDlgProc=StartPageProc;
  52. psp[0].pszHeaderTitle=0;
  53. psp[0].pszHeaderSubTitle=0;
  54. psp[0].lParam=(LPARAM)&wizdata;
  55. psp[1].dwSize=sizeof(PROPSHEETPAGE);
  56. psp[1].dwFlags= PSP_USEHEADERSUBTITLE | PSP_USEHEADERTITLE ;
  57. psp[1].hInstance=hinstExe;
  58. psp[1].pszTemplate=MAKEINTRESOURCE(IDD_VERSION_CHECKING);
  59. psp[1].pfnDlgProc=CheckingPageProc;
  60. psp[1].pszHeaderTitle=MAKEINTRESOURCE(IDS_VERSION_CHECKING_TITLE);
  61. psp[1].pszHeaderSubTitle=MAKEINTRESOURCE(IDS_VERSION_CHECKING_SUBTITLE);
  62. psp[1].lParam=(LPARAM)&wizdata;
  63. psp[2].dwSize=sizeof(PROPSHEETPAGE);
  64. psp[2].dwFlags= PSP_USEHEADERSUBTITLE | PSP_USEHEADERTITLE ;
  65. psp[2].hInstance=hinstExe;
  66. psp[2].pszTemplate=MAKEINTRESOURCE(IDD_CONSTRAINTS);
  67. psp[2].pfnDlgProc=ConstraintsPageProc;
  68. psp[2].pszHeaderTitle=MAKEINTRESOURCE(IDS_CONSTRAINTS_TITLE);
  69. psp[2].pszHeaderSubTitle=MAKEINTRESOURCE(IDS_CONSTRAINTS_SUBTITLE);
  70. psp[2].lParam=(LPARAM)&wizdata;
  71. psp[3].dwSize=sizeof(PROPSHEETPAGE);
  72. psp[3].dwFlags= PSP_USEHEADERSUBTITLE | PSP_USEHEADERTITLE ;
  73. psp[3].hInstance=hinstExe;
  74. psp[3].pszTemplate=MAKEINTRESOURCE(IDD_MESSAGE_EDITOR);
  75. psp[3].pfnDlgProc=MessagePageProc;
  76. psp[3].pszHeaderTitle=MAKEINTRESOURCE(IDS_MESSAGE_EDITOR_TITLE);
  77. psp[3].pszHeaderSubTitle=MAKEINTRESOURCE(IDS_MESSAGE_EDITOR_SUBTITLE);
  78. psp[3].lParam=(LPARAM)&wizdata;
  79. psp[4].dwSize=sizeof(PROPSHEETPAGE);
  80. psp[4].dwFlags= PSP_HIDEHEADER ;
  81. psp[4].hInstance=hinstExe;
  82. psp[4].pszTemplate=MAKEINTRESOURCE(IDD_FINISH);
  83. psp[4].pfnDlgProc=FinishPageProc;
  84. psp[4].pszHeaderTitle=0;
  85. psp[4].pszHeaderSubTitle=0;
  86. psp[4].lParam=(LPARAM)&wizdata;
  87. PROPSHEETHEADER psh;
  88. ZeroMemory(&psh,sizeof(psh));
  89. psh.dwSize=sizeof(PROPSHEETHEADER);
  90. psh.dwFlags=PSH_WIZARD97 | PSH_HEADER | PSH_PROPSHEETPAGE |
  91. PSH_WATERMARK;
  92. psh.hInstance=hinstExe;
  93. psh.nPages=5;
  94. //psh.nStartPage=0;
  95. psh.ppsp=psp;
  96. psh.pszbmHeader=MAKEINTRESOURCE(IDB_HEADER);
  97. psh.pszbmWatermark=MAKEINTRESOURCE(IDB_WATERMARK);
  98. //show or don't show wellcome page
  99. if (CheckForRegKey(HKEY_USERS, szConstraintsKeyPath, KeyName[NOWELLCOME])){
  100. wizdata.bNoWellcome=TRUE;
  101. psh.nStartPage=1;
  102. }else{
  103. wizdata.bNoWellcome=FALSE;
  104. psh.nStartPage=0;
  105. }
  106. //Set up the font for the titles on the intro and ending pages
  107. NONCLIENTMETRICS ncm = {0};
  108. ncm.cbSize = sizeof(ncm);
  109. SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
  110. //Create the intro/end title font
  111. LOGFONT TitleLogFont = ncm.lfMessageFont;
  112. TitleLogFont.lfWeight = FW_BOLD;
  113. lstrcpy(TitleLogFont.lfFaceName, TEXT("MS Shell Dlg"));
  114. HDC hdc = GetDC(NULL); //gets the screen DC
  115. INT FontSize = 12;
  116. if(hdc == NULL) {
  117. return(0);
  118. }
  119. TitleLogFont.lfHeight = 0 - GetDeviceCaps(hdc, LOGPIXELSY) * FontSize / 72;
  120. wizdata.hTitleFont = CreateFontIndirect(&TitleLogFont);
  121. ReleaseDC(NULL, hdc);
  122. PropertySheet(&psh);
  123. return(0);
  124. }