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.

233 lines
6.2 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. // All rights reserved.
  5. //
  6. // File Name:
  7. // iecustom.c
  8. //
  9. // Description:
  10. // This file contains the dialog procedures for the IE customy settings
  11. // pop-up.
  12. //
  13. //----------------------------------------------------------------------------
  14. #include "pch.h"
  15. #include "resource.h"
  16. //----------------------------------------------------------------------------
  17. //
  18. // Function: OnAutoConfigCheckBox
  19. //
  20. // Purpose:
  21. //
  22. // Arguments: IN HWND hwnd - handle to the dialog box
  23. //
  24. // Returns: VOID
  25. //
  26. //----------------------------------------------------------------------------
  27. static VOID
  28. OnAutoConfigCheckBox( IN HWND hwnd )
  29. {
  30. BOOL bGrey = IsDlgButtonChecked( hwnd, IDC_CB_AUTOCONFIG );
  31. EnableWindow( GetDlgItem( hwnd, IDC_AUTOCONFIG_TEXT ), bGrey );
  32. EnableWindow( GetDlgItem( hwnd, IDC_EB_AUTOCONFIG_URL ), bGrey );
  33. EnableWindow( GetDlgItem( hwnd, IDC_AUTOCONFIG_JSCRIPT_TEXT ), bGrey );
  34. EnableWindow( GetDlgItem( hwnd, IDC_EB_AUTOCONFIG_URL_PAC ), bGrey );
  35. }
  36. //----------------------------------------------------------------------------
  37. //
  38. // Function: OnInitCustomSettingsDialog
  39. //
  40. // Purpose:
  41. //
  42. // Arguments: IN HWND hwnd - handle to the dialog box
  43. //
  44. // Returns: VOID
  45. //
  46. //----------------------------------------------------------------------------
  47. static VOID
  48. OnInitCustomSettingsDialog( IN HWND hwnd )
  49. {
  50. //
  51. // Set the text limit on the edit boxes
  52. //
  53. SendDlgItemMessage( hwnd,
  54. IDC_EB_INS_FILE,
  55. EM_LIMITTEXT,
  56. (WPARAM) MAX_INS_LEN,
  57. (LPARAM) 0 );
  58. SendDlgItemMessage( hwnd,
  59. IDC_EB_AUTOCONFIG_URL,
  60. EM_LIMITTEXT,
  61. (WPARAM) MAX_AUTOCONFIG_LEN,
  62. (LPARAM) 0 );
  63. SendDlgItemMessage( hwnd,
  64. IDC_EB_AUTOCONFIG_URL_PAC,
  65. EM_LIMITTEXT,
  66. (WPARAM) MAX_AUTOCONFIG_LEN,
  67. (LPARAM) 0 );
  68. //
  69. // Set the initial values
  70. //
  71. SetWindowText( GetDlgItem( hwnd, IDC_EB_INS_FILE ),
  72. GenSettings.szInsFile );
  73. if( GenSettings.bUseAutoConfigScript )
  74. {
  75. CheckDlgButton( hwnd, IDC_CB_AUTOCONFIG, BST_CHECKED );
  76. }
  77. else
  78. {
  79. CheckDlgButton( hwnd, IDC_CB_AUTOCONFIG, BST_UNCHECKED );
  80. }
  81. SetWindowText( GetDlgItem( hwnd, IDC_EB_AUTOCONFIG_URL ),
  82. GenSettings.szAutoConfigUrl );
  83. SetWindowText( GetDlgItem( hwnd, IDC_EB_AUTOCONFIG_URL_PAC ),
  84. GenSettings.szAutoConfigUrlJscriptOrPac );
  85. //
  86. // Grey/Ungrey the page appropriately
  87. //
  88. OnAutoConfigCheckBox( hwnd );
  89. }
  90. //----------------------------------------------------------------------------
  91. //
  92. // Function: StoreCustomSettings
  93. //
  94. // Purpose:
  95. //
  96. // Arguments: IN HWND hwnd - handle to the dialog box
  97. //
  98. // Returns: BOOL - TRUE if the dialog should close, FALSE if it should stay
  99. // open
  100. //
  101. //----------------------------------------------------------------------------
  102. static BOOL
  103. StoreCustomSettings( IN HWND hwnd )
  104. {
  105. GetWindowText( GetDlgItem( hwnd, IDC_EB_INS_FILE ),
  106. GenSettings.szInsFile,
  107. MAX_INS_LEN + 1 );
  108. GenSettings.bUseAutoConfigScript = IsDlgButtonChecked( hwnd, IDC_CB_AUTOCONFIG );
  109. GetWindowText( GetDlgItem( hwnd, IDC_EB_AUTOCONFIG_URL ),
  110. GenSettings.szAutoConfigUrl,
  111. MAX_AUTOCONFIG_LEN + 1 );
  112. GetWindowText( GetDlgItem( hwnd, IDC_EB_AUTOCONFIG_URL_PAC ),
  113. GenSettings.szAutoConfigUrlJscriptOrPac,
  114. MAX_AUTOCONFIG_LEN + 1 );
  115. if( ! DoesFileExist( GenSettings.szInsFile ) )
  116. {
  117. INT iRet;
  118. iRet = ReportErrorId( hwnd, MSGTYPE_YESNO, IDS_ERR_INS_FILE_NOT_EXIST );
  119. if( iRet == IDNO )
  120. {
  121. return( FALSE );
  122. }
  123. }
  124. return( TRUE );
  125. }
  126. //----------------------------------------------------------------------------
  127. //
  128. // Function: CustomSettingsDlg
  129. //
  130. // Purpose:
  131. //
  132. // Arguments: standard Win32 dialog proc arguments
  133. //
  134. // Returns: standard Win32 dialog proc return value -- whether the message
  135. // was handled or not
  136. //
  137. //----------------------------------------------------------------------------
  138. INT_PTR CALLBACK CustomSettingsDlg(
  139. IN HWND hwnd,
  140. IN UINT uMsg,
  141. IN WPARAM wParam,
  142. IN LPARAM lParam )
  143. {
  144. BOOL bStatus = TRUE;
  145. switch( uMsg ) {
  146. case WM_INITDIALOG:
  147. OnInitCustomSettingsDialog( hwnd );
  148. break;
  149. case WM_COMMAND:
  150. {
  151. int nButtonId;
  152. switch ( nButtonId = LOWORD(wParam) )
  153. {
  154. case IDOK:
  155. // ISSUE-2002/02/28-stelo- do I need to validate proxy addresses?
  156. if( HIWORD( wParam ) == BN_CLICKED ) {
  157. BOOL bCloseDialog;
  158. bCloseDialog = StoreCustomSettings( hwnd );
  159. if( bCloseDialog )
  160. {
  161. EndDialog( hwnd, TRUE );
  162. }
  163. }
  164. break;
  165. case IDCANCEL:
  166. if( HIWORD( wParam ) == BN_CLICKED ) {
  167. EndDialog( hwnd, FALSE );
  168. }
  169. break;
  170. case IDC_CB_AUTOCONFIG:
  171. if( HIWORD( wParam ) == BN_CLICKED ) {
  172. OnAutoConfigCheckBox( hwnd );
  173. }
  174. break;
  175. default:
  176. bStatus = FALSE;
  177. break;
  178. }
  179. }
  180. break;
  181. default:
  182. bStatus = FALSE;
  183. break;
  184. }
  185. return( bStatus );
  186. }