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.

113 lines
3.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: S A U I O B J. H
  7. //
  8. // Contents: Declaration of the Shared Access ConnectionUI object
  9. //
  10. // Notes:
  11. //
  12. // Created: tongl 8 Oct 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "nsbase.h" // must be first to include atl
  17. #include "ncatlps.h"
  18. #include "netshell.h"
  19. #include "netcfgn.h"
  20. #include "nsres.h"
  21. #include "resource.h"
  22. class ATL_NO_VTABLE CSharedAccessConnectionUi :
  23. public CComObjectRootEx <CComObjectThreadModel>,
  24. public CComCoClass <CSharedAccessConnectionUi, &CLSID_SharedAccessConnectionUi>,
  25. public INetConnectionConnectUi,
  26. public INetConnectionPropertyUi2,
  27. public INetConnectionUiLock
  28. {
  29. public:
  30. CSharedAccessConnectionUi()
  31. {
  32. m_pconn = NULL;
  33. m_pspSharedAccessPage = NULL;
  34. m_pnc = NULL;
  35. m_fReadOnly = FALSE;
  36. m_fNeedReboot = FALSE;
  37. m_fAccessDenied = FALSE;
  38. }
  39. ~CSharedAccessConnectionUi()
  40. {
  41. ReleaseObj(m_pconn);
  42. }
  43. DECLARE_REGISTRY_RESOURCEID(IDR_SHAREDACCESS_UI)
  44. BEGIN_COM_MAP(CSharedAccessConnectionUi)
  45. COM_INTERFACE_ENTRY(INetConnectionConnectUi)
  46. COM_INTERFACE_ENTRY(INetConnectionPropertyUi)
  47. COM_INTERFACE_ENTRY(INetConnectionPropertyUi2)
  48. COM_INTERFACE_ENTRY(INetConnectionUiLock)
  49. END_COM_MAP()
  50. // INetConnectionConnectUi
  51. //
  52. STDMETHOD (SetConnection)(INetConnection* pCon);
  53. STDMETHOD (Connect)(HWND hwndParent, DWORD dwFlags);
  54. STDMETHOD (Disconnect)(HWND hwndParent, DWORD dwFlags);
  55. // INetConnectionPropertyUi2
  56. //
  57. STDMETHOD (AddPages)(HWND hwndParent,
  58. LPFNADDPROPSHEETPAGE pfnAddPage,
  59. LPARAM lParam);
  60. STDMETHOD (GetIcon) (
  61. DWORD dwSize,
  62. HICON *phIcon );
  63. // INetConnectionUiLock
  64. STDMETHOD (QueryLock) (PWSTR* ppszwLockHolder);
  65. public:
  66. private:
  67. //==============
  68. // Data members
  69. //==============
  70. INetConnection * m_pconn; // Pointer to LAN connection object
  71. CPropSheetPage * m_pspSharedAccessPage; // Networking property page
  72. INetCfg * m_pnc; // This is the writable INetCfg passed to the Lan Wizard
  73. BOOLEAN m_fReadOnly; // If TRUE, then access to inetcfg is RO
  74. BOOLEAN m_fNeedReboot; // If TRUE, then we are readonly becuase INetCfg needs a reboot
  75. BOOLEAN m_fAccessDenied;// If TRUE, the user is not logged on as admin
  76. };
  77. class CSharedAccessConnectionUiDlg :
  78. public CDialogImpl<CSharedAccessConnectionUiDlg>
  79. {
  80. BEGIN_MSG_MAP(CSharedAccessConnectionUiDlg)
  81. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  82. END_MSG_MAP()
  83. enum { IDD = IDD_LAN_CONNECT}; // borrowing the lan dialog template
  84. CSharedAccessConnectionUiDlg() { m_pconn = NULL; };
  85. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam,
  86. LPARAM lParam, BOOL& bHandled);
  87. VOID SetConnection(INetConnection *pconn) {m_pconn = pconn;}
  88. private:
  89. INetConnection * m_pconn;
  90. };