1c73d8c64SGiannis Adamopoulos 2c73d8c64SGiannis Adamopoulos 3c73d8c64SGiannis Adamopoulos typedef struct { 4c73d8c64SGiannis Adamopoulos int colnameid; 5c73d8c64SGiannis Adamopoulos int pcsFlags; 6c73d8c64SGiannis Adamopoulos int fmt; 7c73d8c64SGiannis Adamopoulos int cxChar; 8c73d8c64SGiannis Adamopoulos } shvheader; 9c73d8c64SGiannis Adamopoulos 10c73d8c64SGiannis Adamopoulos class CNetworkConnections: 11c73d8c64SGiannis Adamopoulos public CComCoClass<CNetworkConnections, &CLSID_ConnectionFolder>, 12c73d8c64SGiannis Adamopoulos public CComObjectRootEx<CComMultiThreadModelNoCS>, 13c73d8c64SGiannis Adamopoulos public IPersistFolder2, 14c73d8c64SGiannis Adamopoulos public IShellExtInit, 15c73d8c64SGiannis Adamopoulos public IShellFolder2, 16c73d8c64SGiannis Adamopoulos public IOleCommandTarget, 17c73d8c64SGiannis Adamopoulos public IShellFolderViewCB, 18c73d8c64SGiannis Adamopoulos public IShellExecuteHookW 19c73d8c64SGiannis Adamopoulos { 20c73d8c64SGiannis Adamopoulos public: 21c73d8c64SGiannis Adamopoulos CNetworkConnections(); 22c73d8c64SGiannis Adamopoulos ~CNetworkConnections(); 23c73d8c64SGiannis Adamopoulos 24c73d8c64SGiannis Adamopoulos // IPersistFolder2 25*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetClassID)(CLSID *lpClassId) override; 26*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidl) override; 27*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetCurFolder)(PIDLIST_ABSOLUTE *pidl) override; 28c73d8c64SGiannis Adamopoulos 29c73d8c64SGiannis Adamopoulos // IShellFolder 30*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(ParseDisplayName)(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override; 31*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(EnumObjects)(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override; 32*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(BindToObject)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override; 33*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(BindToStorage)(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override; 34*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(CompareIDs)(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override; 35*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(CreateViewObject)(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override; 36*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetAttributesOf)(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override; 37*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetUIObjectOf)(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) override; 38*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetDisplayNameOf)(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override; 39*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(SetNameOf)(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override; 40c73d8c64SGiannis Adamopoulos 41c73d8c64SGiannis Adamopoulos // IShellFolder2 42*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetDefaultSearchGUID)(GUID *pguid) override; 43*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(EnumSearches)(IEnumExtraSearch **ppenum) override; 44*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetDefaultColumn)(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override; 45*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetDefaultColumnState)(UINT iColumn, DWORD *pcsFlags) override; 46*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetDetailsEx)(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override; 47*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetDetailsOf)(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override; 48*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(MapColumnToSCID)(UINT column, SHCOLUMNID *pscid) override; 49c73d8c64SGiannis Adamopoulos 50c73d8c64SGiannis Adamopoulos // IShellExtInit 51*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override; 52c73d8c64SGiannis Adamopoulos 53c73d8c64SGiannis Adamopoulos // IOleCommandTarget 54*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(Exec)(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override; 55*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) override; 56c73d8c64SGiannis Adamopoulos 57c73d8c64SGiannis Adamopoulos // IShellFolderViewCB 58*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(MessageSFVCB)(UINT uMsg, WPARAM wParam, LPARAM lParam) override; 59c73d8c64SGiannis Adamopoulos 60c73d8c64SGiannis Adamopoulos // IShellExecuteHookW 61*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(Execute)(LPSHELLEXECUTEINFOW pei) override; 62c73d8c64SGiannis Adamopoulos 63c73d8c64SGiannis Adamopoulos private: 64c73d8c64SGiannis Adamopoulos 65c73d8c64SGiannis Adamopoulos /* both paths are parsible from the desktop */ 66c73d8c64SGiannis Adamopoulos PIDLIST_ABSOLUTE m_pidlRoot; 67769b102eSGiannis Adamopoulos CComPtr<IOleCommandTarget> m_lpOleCmd; 68c73d8c64SGiannis Adamopoulos 69c73d8c64SGiannis Adamopoulos public: 70c73d8c64SGiannis Adamopoulos 71c73d8c64SGiannis Adamopoulos BEGIN_COM_MAP(CNetworkConnections) 72c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersistFolder2) 73c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder2) 74c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2) 75c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder2) 76c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2) 77c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) 78c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) 79c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IShellFolderViewCB, IShellFolderViewCB) 80c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IShellExecuteHookW, IShellExecuteHookW) 81c73d8c64SGiannis Adamopoulos END_COM_MAP() 82c73d8c64SGiannis Adamopoulos 83c73d8c64SGiannis Adamopoulos DECLARE_NO_REGISTRY() 84c73d8c64SGiannis Adamopoulos DECLARE_NOT_AGGREGATABLE(CNetworkConnections) 85c73d8c64SGiannis Adamopoulos DECLARE_PROTECT_FINAL_CONSTRUCT() 86c73d8c64SGiannis Adamopoulos }; 87c73d8c64SGiannis Adamopoulos 88c73d8c64SGiannis Adamopoulos class CNetConUiObject: 89c73d8c64SGiannis Adamopoulos public CComObjectRootEx<CComMultiThreadModelNoCS>, 90c73d8c64SGiannis Adamopoulos public IContextMenu3, 91c73d8c64SGiannis Adamopoulos public IObjectWithSite, 92c73d8c64SGiannis Adamopoulos public IQueryInfo, 93c73d8c64SGiannis Adamopoulos public IExtractIconW 94c73d8c64SGiannis Adamopoulos { 95c73d8c64SGiannis Adamopoulos private: 96c73d8c64SGiannis Adamopoulos PCUITEMID_CHILD m_pidl; 97769b102eSGiannis Adamopoulos CComPtr<IUnknown> m_pUnknown; 98769b102eSGiannis Adamopoulos CComPtr<IOleCommandTarget> m_lpOleCmd; 99c73d8c64SGiannis Adamopoulos 100c73d8c64SGiannis Adamopoulos public: 101c73d8c64SGiannis Adamopoulos CNetConUiObject(); 102c73d8c64SGiannis Adamopoulos ~CNetConUiObject(); 103c73d8c64SGiannis Adamopoulos HRESULT WINAPI Initialize(PCUITEMID_CHILD pidl, IOleCommandTarget *lpOleCmd); 104c73d8c64SGiannis Adamopoulos 105c73d8c64SGiannis Adamopoulos // IContextMenu3 106*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override; 107*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici) override; 108*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetCommandString)(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) override; 109*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(HandleMenuMsg)( UINT uMsg, WPARAM wParam, LPARAM lParam) override; 110*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(HandleMenuMsg2)(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) override; 111c73d8c64SGiannis Adamopoulos 112c73d8c64SGiannis Adamopoulos // IObjectWithSite 113*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(SetSite)(IUnknown *punk) override; 114*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetSite)(REFIID iid, void **ppvSite) override; 115c73d8c64SGiannis Adamopoulos 116c73d8c64SGiannis Adamopoulos // IQueryInfo 117*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetInfoFlags)(DWORD *pdwFlags) override; 118*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetInfoTip)(DWORD dwFlags, WCHAR **ppwszTip) override; 119c73d8c64SGiannis Adamopoulos 120c73d8c64SGiannis Adamopoulos // IExtractIconW 121*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(GetIconLocation)(UINT uFlags, LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags) override; 122*b2d56cf3SKatayama Hirofumi MZ STDMETHOD(Extract)(LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) override; 123c73d8c64SGiannis Adamopoulos 124c73d8c64SGiannis Adamopoulos BEGIN_COM_MAP(CNetConUiObject) 125c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu3) 126c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu3) 127c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IContextMenu3, IContextMenu3) 128c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) 129c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IQueryInfo, IQueryInfo) 130c73d8c64SGiannis Adamopoulos COM_INTERFACE_ENTRY_IID(IID_IExtractIconW, IExtractIconW) 131c73d8c64SGiannis Adamopoulos END_COM_MAP() 132c73d8c64SGiannis Adamopoulos 133c73d8c64SGiannis Adamopoulos DECLARE_NOT_AGGREGATABLE(CNetConUiObject) 134c73d8c64SGiannis Adamopoulos DECLARE_PROTECT_FINAL_CONSTRUCT() 135c73d8c64SGiannis Adamopoulos }; 136c73d8c64SGiannis Adamopoulos 137c73d8c64SGiannis Adamopoulos HRESULT ShowNetConnectionProperties(INetConnection * pNetConnect, HWND hwnd); 138