1 2 /// CLASSID 3 /// {7007ACC5-3202-11D1-AAD2-00805FC1270E} 4 /// open network properties and wlan properties 5 6 typedef enum 7 { 8 NET_TYPE_CLIENT = 1, 9 NET_TYPE_SERVICE = 2, 10 NET_TYPE_PROTOCOL = 3 11 } NET_TYPE; 12 13 typedef struct 14 { 15 NET_TYPE Type; 16 DWORD dwCharacteristics; 17 LPWSTR szHelp; 18 INetCfgComponent *pNCfgComp; 19 UINT NumPropDialogOpen; 20 } NET_ITEM, *PNET_ITEM; 21 22 class CNetConnectionPropertyUi: 23 public CComCoClass<CNetConnectionPropertyUi, &CLSID_LanConnectionUi>, 24 public CComObjectRootEx<CComMultiThreadModelNoCS>, 25 public INetConnectionConnectUi, 26 public INetConnectionPropertyUi2, 27 public INetLanConnectionUiInfo 28 { 29 public: 30 CNetConnectionPropertyUi(); 31 ~CNetConnectionPropertyUi(); 32 33 // INetConnectionPropertyUi2 34 virtual HRESULT WINAPI AddPages(HWND hwndParent, LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam); 35 virtual HRESULT WINAPI GetIcon(DWORD dwSize, HICON *phIcon); 36 37 // INetLanConnectionUiInfo 38 virtual HRESULT WINAPI GetDeviceGuid(GUID *pGuid); 39 40 // INetConnectionConnectUi 41 virtual HRESULT WINAPI SetConnection(INetConnection* pCon); 42 virtual HRESULT WINAPI Connect(HWND hwndParent, DWORD dwFlags); 43 virtual HRESULT WINAPI Disconnect(HWND hwndParent, DWORD dwFlags); 44 45 private: 46 BOOL GetINetCfgComponent(INetCfg *pNCfg, INetCfgComponent ** pOut); 47 VOID EnumComponents(HWND hDlgCtrl, INetCfg *pNCfg, const GUID *CompGuid, UINT Type); 48 VOID InitializeLANPropertiesUIDlg(HWND hwndDlg); 49 VOID ShowNetworkComponentProperties(HWND hwndDlg); 50 BOOL GetDeviceInstanceID(OUT LPOLESTR *DeviceInstanceID); 51 static INT_PTR CALLBACK LANPropertiesUIDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 52 53 CComPtr<INetConnection> m_pCon; 54 CComPtr<INetCfgLock> m_NCfgLock; 55 CComPtr<INetCfg> m_pNCfg; 56 NETCON_PROPERTIES * m_pProperties; 57 58 public: 59 DECLARE_NO_REGISTRY() 60 DECLARE_NOT_AGGREGATABLE(CNetConnectionPropertyUi) 61 DECLARE_PROTECT_FINAL_CONSTRUCT() 62 63 BEGIN_COM_MAP(CNetConnectionPropertyUi) 64 COM_INTERFACE_ENTRY_IID(IID_INetConnectionConnectUi, INetConnectionConnectUi) 65 COM_INTERFACE_ENTRY_IID(IID_INetConnectionPropertyUi, INetConnectionPropertyUi2) 66 COM_INTERFACE_ENTRY_IID(IID_INetConnectionPropertyUi2, INetConnectionPropertyUi2) 67 COM_INTERFACE_ENTRY_IID(IID_INetLanConnectionUiInfo, INetLanConnectionUiInfo) 68 END_COM_MAP() 69 }; 70