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.

198 lines
6.7 KiB

  1. //-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: T C P W I N S . H
  7. //
  8. // Contents: CTcpWinsPage declaration
  9. //
  10. // Notes: The "WINS Address" page
  11. //
  12. // Author: tongl 12 Nov 1997
  13. //
  14. //-----------------------------------------------------------------------
  15. #pragma once
  16. #include <ncxbase.h>
  17. #include <ncatlps.h>
  18. #include "ipctrl.h"
  19. #include "tcpconst.h"
  20. class CTcpWinsPage : public CPropSheetPage
  21. {
  22. public:
  23. // Declare the message map
  24. BEGIN_MSG_MAP(CTcpWinsPage)
  25. // Initialize dialog
  26. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  27. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  28. MESSAGE_HANDLER(WM_HELP, OnHelp)
  29. // Property page notification message handlers
  30. NOTIFY_CODE_HANDLER(PSN_APPLY, OnApply)
  31. NOTIFY_CODE_HANDLER(PSN_KILLACTIVE, OnKillActive)
  32. NOTIFY_CODE_HANDLER(PSN_SETACTIVE, OnActive)
  33. NOTIFY_CODE_HANDLER(PSN_RESET, OnCancel)
  34. NOTIFY_CODE_HANDLER(PSN_QUERYCANCEL, OnQueryCancel)
  35. // Control message handlers
  36. COMMAND_ID_HANDLER(IDC_WINS_ADD, OnAddServer)
  37. COMMAND_ID_HANDLER(IDC_WINS_EDIT, OnEditServer)
  38. COMMAND_ID_HANDLER(IDC_WINS_REMOVE, OnRemoveServer)
  39. COMMAND_ID_HANDLER(IDC_WINS_UP, OnServerUp)
  40. COMMAND_ID_HANDLER(IDC_WINS_DOWN, OnServerDown)
  41. COMMAND_ID_HANDLER(IDC_WINS_SERVER_LIST, OnServerList)
  42. COMMAND_ID_HANDLER(IDC_WINS_LOOKUP, OnLookUp)
  43. COMMAND_ID_HANDLER(IDC_WINS_LMHOST, OnLMHost)
  44. COMMAND_ID_HANDLER(IDC_RAD_ENABLE_NETBT, OnEnableNetbios)
  45. COMMAND_ID_HANDLER(IDC_RAD_DISABLE_NETBT, OnDisableNetbios)
  46. COMMAND_ID_HANDLER(IDC_RAD_UNSET_NETBT, OnUnsetNetBios)
  47. END_MSG_MAP()
  48. // Constructors/Destructors
  49. public:
  50. CTcpWinsPage(CTcpipcfg * ptcpip,
  51. CTcpAddrPage * pTcpAddrPage,
  52. ADAPTER_INFO * pAdapterDlg,
  53. GLOBAL_INFO * pGlbDlg,
  54. const DWORD * phelpIDs = NULL);
  55. public:
  56. // message map functions
  57. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam,
  58. LPARAM lParam, BOOL& fHandled);
  59. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam,
  60. LPARAM lParam, BOOL& fHandled);
  61. LRESULT OnHelp(UINT uMsg, WPARAM wParam,
  62. LPARAM lParam, BOOL& fHandled);
  63. // notify handlers for the property page
  64. LRESULT OnActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  65. LRESULT OnKillActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  66. LRESULT OnApply(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  67. LRESULT OnCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  68. LRESULT OnQueryCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  69. // control message handlers
  70. LRESULT OnAddServer(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  71. LRESULT OnEditServer(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  72. LRESULT OnRemoveServer(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  73. LRESULT OnServerUp(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  74. LRESULT OnServerDown(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  75. LRESULT OnServerList(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  76. LRESULT OnLookUp(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  77. LRESULT OnLMHost(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  78. LRESULT OnEnableNetbios(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  79. LRESULT OnDisableNetbios(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  80. LRESULT OnUnsetNetBios(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  81. public:
  82. // This function adds card descriptions to the combo box
  83. BOOL InitPage();
  84. void UpdateIpInfo();
  85. static UINT_PTR CALLBACK HookProcOldStyle(
  86. HWND hdlg, // handle to dialog box
  87. UINT uiMsg, // message identifier
  88. WPARAM wParam, // message parameter
  89. LPARAM lParam // message parameter
  90. )
  91. {
  92. return 0;
  93. }
  94. private:
  95. CTcpipcfg * m_ptcpip;
  96. CTcpAddrPage * m_pParentDlg;
  97. ADAPTER_INFO * m_pAdapterInfo;
  98. GLOBAL_INFO * m_pglb;
  99. BOOL m_fModified;
  100. BOOL m_fLmhostsFileReset;
  101. const DWORD* m_adwHelpIDs;
  102. // Inlines
  103. BOOL IsModified() {return m_fModified;}
  104. void SetModifiedTo(BOOL bState) {m_fModified = bState;}
  105. void PageModified() { m_fModified = TRUE; PropSheet_Changed(GetParent(), m_hWnd);}
  106. OPENFILENAME m_ofn;
  107. WCHAR m_szFilter[IP_LIMIT];
  108. public:
  109. // server: either the one added, or edited
  110. tstring m_strNewIpAddress;
  111. // server: used as work space for moving entries in the listboxes
  112. tstring m_strMovingEntry;
  113. tstring m_strAddServer; // OK or Add button server dialog
  114. BOOL m_fEditState;
  115. HANDLES m_hServers;
  116. };
  117. class CWinsServerDialog : public CDialogImpl<CWinsServerDialog>
  118. {
  119. public:
  120. enum { IDD = IDD_WINS_SERVER };
  121. BEGIN_MSG_MAP(CWinsServerDialog)
  122. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  123. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  124. MESSAGE_HANDLER(WM_HELP, OnHelp)
  125. MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor);
  126. COMMAND_ID_HANDLER(IDOK, OnOk)
  127. COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
  128. COMMAND_ID_HANDLER(IDC_WINS_CHANGE_SERVER, OnChange)
  129. NOTIFY_CODE_HANDLER(IPN_FIELDCHANGED, OnIpFieldChange)
  130. END_MSG_MAP()
  131. public:
  132. CWinsServerDialog(CTcpWinsPage * pTcpWinsPage,
  133. const DWORD* pamhidsHelp = NULL,
  134. int iIndex = -1);
  135. ~CWinsServerDialog(){};
  136. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  137. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  138. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  139. LRESULT OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  140. LRESULT OnOk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  141. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  142. LRESULT OnChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  143. LRESULT OnIpFieldChange(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  144. // Dialog creation overides
  145. public:
  146. IpControl m_ipAddress;
  147. private:
  148. HWND m_hButton; // this is the IDOK button, the text of the button changes
  149. // with the context.
  150. CTcpWinsPage * m_pParentDlg;
  151. const DWORD * m_adwHelpIDs;
  152. int m_iIndex;
  153. };