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.

207 lines
4.7 KiB

  1. /*****************************************************************************
  2. *
  3. * $Workfile: AddWelcm.cpp $
  4. *
  5. * Copyright (C) 1997 Hewlett-Packard Company.
  6. * Copyright (c) 1997 Microsoft Corporation.
  7. * All rights reserved.
  8. *
  9. * 11311 Chinden Blvd.
  10. * Boise, Idaho 83714
  11. *
  12. *
  13. *****************************************************************************/
  14. /*
  15. * Author: Becky Jacobsen
  16. */
  17. #include "precomp.h"
  18. #include "UIMgr.h"
  19. #include "AddWelcm.h"
  20. #include "resource.h"
  21. //
  22. // FUNCTION: CWelcomeDlg constructor
  23. //
  24. // PURPOSE: initialize a CWelcomeDlg class
  25. //
  26. CWelcomeDlg::CWelcomeDlg()
  27. {
  28. } // constructor
  29. //
  30. // FUNCTION: CWelcomeDlg destructor
  31. //
  32. // PURPOSE: deinitialize a CWelcomeDlg class
  33. //
  34. CWelcomeDlg::~CWelcomeDlg()
  35. {
  36. } // destructor
  37. //
  38. // FUNCTION: WelcomeDialog(HWND, UINT, WPARAM, LPARAM)
  39. //
  40. // PURPOSE: To process messages from the welcome dialog for adding a port.
  41. //
  42. // MESSAGES:
  43. //
  44. // WM_INITDIALOG - intializes the page
  45. // WM_COMMAND - handles button presses and text changes in edit controls.
  46. //
  47. //
  48. INT_PTR CALLBACK WelcomeDialog(
  49. HWND hDlg,
  50. UINT message,
  51. WPARAM wParam,
  52. LPARAM lParam)
  53. {
  54. CWelcomeDlg *wndDlg = NULL;
  55. wndDlg = (CWelcomeDlg *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
  56. switch (message)
  57. {
  58. case WM_INITDIALOG:
  59. //
  60. // Remove the system menu and context help for the wizard
  61. //
  62. {
  63. HWND hPropSheet = GetParent(hDlg);
  64. LONG_PTR lStyle = GetWindowLongPtr(hPropSheet, GWL_STYLE);
  65. lStyle &= ~(WS_SYSMENU | DS_CONTEXTHELP);
  66. SetWindowLongPtr(hPropSheet, GWL_STYLE, lStyle);
  67. }
  68. wndDlg = new CWelcomeDlg;
  69. if( wndDlg == NULL )
  70. return( FALSE );
  71. SetWindowLongPtr(hDlg, GWLP_USERDATA, (UINT_PTR)wndDlg);
  72. return wndDlg->OnInitDialog(hDlg, wParam, lParam);
  73. break;
  74. case WM_COMMAND:
  75. return wndDlg->OnCommand(hDlg, wParam, lParam);
  76. break;
  77. case WM_NOTIFY:
  78. return wndDlg->OnNotify(hDlg, wParam, lParam);
  79. break;
  80. case WM_DESTROY:
  81. delete wndDlg;
  82. break;
  83. default:
  84. return FALSE;
  85. }
  86. return TRUE;
  87. } // WelcomeDialog
  88. //
  89. // FUNCTION: OnInitDialog(HWND hDlg)
  90. //
  91. // PURPOSE: Initialize the dialog.
  92. //
  93. BOOL CWelcomeDlg::OnInitDialog(HWND hDlg, WPARAM, LPARAM lParam)
  94. {
  95. m_pParams = (ADD_PARAM_PACKAGE *) ((PROPSHEETPAGE *) lParam)->lParam;
  96. // Initialize the outgoing structure
  97. m_pParams->dwDeviceType = 0;
  98. m_pParams->pData->cbSize = sizeof(PORT_DATA_1);
  99. m_pParams->pData->dwCoreUIVersion = COREUI_VERSION;
  100. lstrcpyn(m_pParams->pData->sztPortName, TEXT(""), MAX_PORTNAME_LEN);
  101. lstrcpyn(m_pParams->pData->sztHostAddress, TEXT(""), MAX_NETWORKNAME_LEN);
  102. m_pParams->pData->dwPortNumber = DEFAULT_PORT_NUMBER;
  103. m_pParams->pData->dwVersion = DEFAULT_VERSION;
  104. m_pParams->pData->dwProtocol = DEFAULT_PROTOCOL;
  105. lstrcpyn(m_pParams->pData->sztQueue, TEXT(""), MAX_QUEUENAME_LEN);
  106. lstrcpyn(m_pParams->pData->sztIPAddress, TEXT(""), MAX_IPADDR_STR_LEN);
  107. lstrcpyn(m_pParams->pData->sztHardwareAddress, TEXT(""), MAX_ADDRESS_STR_LEN);
  108. lstrcpyn(m_pParams->pData->sztSNMPCommunity, DEFAULT_SNMP_COMUNITY, MAX_SNMP_COMMUNITY_STR_LEN);
  109. m_pParams->pData->dwSNMPEnabled = FALSE;
  110. m_pParams->pData->dwSNMPDevIndex = DEFAULT_SNMP_DEVICE_INDEX;
  111. m_pParams->UIManager->SetControlFont(hDlg, IDC_TITLE);
  112. return TRUE;
  113. } // OnInitDialog
  114. //
  115. // FUNCTION: OnCommand()
  116. //
  117. // PURPOSE: Process WM_COMMAND message
  118. //
  119. BOOL CWelcomeDlg::OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
  120. {
  121. switch(HIWORD(wParam)) {
  122. case BN_CLICKED:
  123. // return OnButtonClicked(hDlg, wParam);
  124. break;
  125. case EN_UPDATE:
  126. // one of the text controls had text changed in it.
  127. // return OnEnUpdate(hDlg, wParam, lParam);
  128. break;
  129. default:
  130. return FALSE;
  131. break;
  132. }
  133. return TRUE;
  134. } // OnCommand
  135. //
  136. // FUNCTION: OnNotify()
  137. //
  138. // PURPOSE: Process WM_NOTIFY message
  139. //
  140. BOOL CWelcomeDlg::OnNotify(HWND hDlg, WPARAM wParam, LPARAM lParam)
  141. {
  142. switch (((NMHDR FAR *) lParam)->code) {
  143. case PSN_KILLACTIVE:
  144. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
  145. return TRUE;
  146. break;
  147. case PSN_RESET:
  148. // reset to the original values
  149. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
  150. break;
  151. case PSN_SETACTIVE:
  152. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_NEXT /*| PSWIZB_BACK | PSWIZB_FINISH */);
  153. break;
  154. case PSN_WIZNEXT:
  155. // the Next button was pressed
  156. break;
  157. case PSN_QUERYCANCEL:
  158. m_pParams->dwLastError = ERROR_CANCELLED;
  159. return FALSE;
  160. break;
  161. default:
  162. return FALSE;
  163. }
  164. return TRUE;
  165. } // OnCommand