Leaked source code of windows server 2003
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.

301 lines
6.1 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. tapi.cpp
  5. Abstract:
  6. This file implements the welcome and finish pages.
  7. Environment:
  8. WIN32 User Mode
  9. Author:
  10. Andrew Ritz (andrewr) 24-July-1998
  11. --*/
  12. #include "ntoc.h"
  13. #pragma hdrstop
  14. HFONT hBigFont = NULL;
  15. HFONT
  16. GetBigFont(
  17. void
  18. )
  19. {
  20. LOGFONT LargeFont;
  21. NONCLIENTMETRICS ncm = {0};
  22. WCHAR FontName[100];
  23. WCHAR FontSize[30];
  24. int iFontSize;
  25. HDC hdc;
  26. HFONT hFont = NULL;
  27. //
  28. // get the large fonts for wizard97
  29. //
  30. ncm.cbSize = sizeof(ncm);
  31. SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
  32. CopyMemory((LPVOID* )&LargeFont,(LPVOID *) &ncm.lfMessageFont,sizeof(LargeFont) );
  33. LoadStringW(hInstance,IDS_LARGEFONT_NAME,FontName,sizeof(FontName)/sizeof(WCHAR) );
  34. LoadStringW(hInstance,IDS_LARGEFONT_SIZE,FontSize,sizeof(FontSize)/sizeof(WCHAR) );
  35. iFontSize = wcstoul( FontSize, NULL, 10 );
  36. // make sure we at least have some basic font
  37. if (*FontName == 0 || iFontSize == 0) {
  38. lstrcpy(FontName,TEXT("MS Shell Dlg") );
  39. iFontSize = 18;
  40. }
  41. LargeFont.lfFaceName[0] = 0;
  42. lstrcpyn(LargeFont.lfFaceName, FontName, sizeof(LargeFont.lfFaceName)/sizeof(LargeFont.lfFaceName[0]));
  43. LargeFont.lfFaceName[sizeof(LargeFont.lfFaceName)/sizeof(LargeFont.lfFaceName[0])-1] = 0;
  44. LargeFont.lfWeight = FW_BOLD;
  45. if ((hdc = GetDC(NULL))) {
  46. LargeFont.lfHeight = 0 - (GetDeviceCaps(hdc,LOGPIXELSY) * iFontSize / 72);
  47. hFont = CreateFontIndirect(&LargeFont);
  48. ReleaseDC( NULL, hdc);
  49. }
  50. return hFont;
  51. }
  52. void
  53. WelcomeInit(
  54. void
  55. )
  56. {
  57. if (!hBigFont) {
  58. hBigFont = GetBigFont();
  59. }
  60. return;
  61. }
  62. void
  63. WelcomeCommit(
  64. void
  65. )
  66. {
  67. return;
  68. }
  69. #if 0
  70. void
  71. ReinstallInit(
  72. void
  73. )
  74. {
  75. if (!hBigFont) {
  76. hBigFont = GetBigFont();
  77. }
  78. return;
  79. }
  80. void
  81. ReinstallCommit(
  82. void
  83. )
  84. {
  85. return;
  86. }
  87. #endif
  88. void
  89. FinishInit(
  90. void
  91. )
  92. {
  93. if (!hBigFont) {
  94. hBigFont = GetBigFont();
  95. }
  96. return;
  97. }
  98. void
  99. FinishCommit(
  100. void
  101. )
  102. {
  103. return;
  104. }
  105. INT_PTR CALLBACK
  106. WelcomeDlgProc(
  107. HWND hwnd,
  108. UINT message,
  109. WPARAM wParam,
  110. LPARAM lParam
  111. )
  112. {
  113. static BOOL FirstTime = TRUE;
  114. CommonWizardProc( hwnd, message, wParam, lParam, WizPageWelcome );
  115. switch( message ) {
  116. case WM_INITDIALOG:
  117. if (hBigFont) {
  118. SetWindowFont(GetDlgItem(hwnd,IDT_TITLE), hBigFont, TRUE);
  119. }
  120. break;
  121. case WM_NOTIFY:
  122. switch (((NMHDR *) lParam)->code) {
  123. case PSN_SETACTIVE:
  124. #if 0
  125. if (SetupInitComponent.SetupData.OperationFlags & SETUPOP_BATCH) {
  126. PropSheet_PressButton( GetParent(hwnd), PSBTN_NEXT );
  127. return TRUE;
  128. }
  129. #else
  130. if (SetupInitComponent.SetupData.OperationFlags & SETUPOP_BATCH) {
  131. PropSheet_PressButton( GetParent(hwnd), PSBTN_NEXT );
  132. return TRUE;
  133. }
  134. if (FirstTime) {
  135. SetWindowLongPtr( hwnd, DWLP_MSGRESULT, -1 );
  136. FirstTime = FALSE;
  137. return TRUE;
  138. }
  139. #endif
  140. break;
  141. }
  142. break;
  143. }
  144. return FALSE;
  145. }
  146. INT_PTR CALLBACK
  147. FinishDlgProc(
  148. HWND hwnd,
  149. UINT message,
  150. WPARAM wParam,
  151. LPARAM lParam
  152. )
  153. {
  154. CommonWizardProc( hwnd, message, wParam, lParam, WizPageFinal );
  155. switch( message ) {
  156. case WM_INITDIALOG:
  157. //PropSheet_SetWizButtons( GetParent(hwnd), PSWIZB_FINISH );
  158. //
  159. // don't allow cancel on the finish page...it's too late
  160. //
  161. ShowWindow(GetDlgItem(GetParent(hwnd),IDCANCEL),SW_HIDE);
  162. if (hBigFont) {
  163. SetWindowFont(GetDlgItem(hwnd,IDT_TITLE), hBigFont, TRUE);
  164. }
  165. break;
  166. case WM_NOTIFY:
  167. switch (((NMHDR *) lParam)->code) {
  168. case PSN_SETACTIVE:
  169. if (SetupInitComponent.SetupData.OperationFlags & SETUPOP_BATCH) {
  170. PropSheet_PressButton( GetParent(hwnd), PSBTN_FINISH );
  171. return TRUE;
  172. }
  173. }
  174. break;
  175. }
  176. return FALSE;
  177. }
  178. #if 0
  179. BOOL CALLBACK
  180. ReinstallDlgProc(
  181. HWND hwnd,
  182. UINT message,
  183. WPARAM wParam,
  184. LPARAM lParam
  185. )
  186. {
  187. CommonWizardProc( hwnd, message, wParam, lParam, WizPageReinstall );
  188. switch( message ) {
  189. case WM_INITDIALOG:
  190. //PropSheet_SetWizButtons( GetParent(hwnd), PSWIZB_BACK | PSWIZB_NEXT );
  191. break;
  192. case WM_NOTIFY:
  193. switch (((NMHDR *) lParam)->code) {
  194. case PSN_SETACTIVE:
  195. //if (!NoChanges) {
  196. // SetWindowLong( hDlg, DWL_MSGRESULT, -1 );
  197. //}
  198. break;
  199. case PSN_WIZNEXT:
  200. if (IsDlgButtonChecked(hwnd,IDYES)) {
  201. SetupInitComponent.HelperRoutines.SetSetupMode(
  202. SetupInitComponent.HelperRoutines.OcManagerContext ,
  203. SETUPMODE_REINSTALL | SetupInitComponent.HelperRoutines.GetSetupMode( SetupInitComponent.HelperRoutines.OcManagerContext )
  204. );
  205. }
  206. break;
  207. default:
  208. ;
  209. };
  210. default:
  211. ;
  212. };
  213. return FALSE;
  214. }
  215. #endif