ReactOS 0.4.15-dev-8102-g108db8f
CNetConUiObject Class Reference

#include <shfldr_netconnect.h>

Inheritance diagram for CNetConUiObject:
Collaboration diagram for CNetConUiObject:

Public Member Functions

 CNetConUiObject ()
 
 ~CNetConUiObject ()
 
HRESULT WINAPI Initialize (PCUITEMID_CHILD pidl, IOleCommandTarget *lpOleCmd)
 
STDMETHOD() QueryContextMenu (HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
 
STDMETHOD() InvokeCommand (LPCMINVOKECOMMANDINFO lpici) override
 
STDMETHOD() GetCommandString (UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) override
 
STDMETHOD() HandleMenuMsg (UINT uMsg, WPARAM wParam, LPARAM lParam) override
 
STDMETHOD() HandleMenuMsg2 (UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) override
 
STDMETHOD() SetSite (IUnknown *punk) override
 
STDMETHOD() GetSite (REFIID iid, void **ppvSite) override
 
STDMETHOD() GetInfoFlags (DWORD *pdwFlags) override
 
STDMETHOD() GetInfoTip (DWORD dwFlags, WCHAR **ppwszTip) override
 
STDMETHOD() GetIconLocation (UINT uFlags, LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags) override
 
STDMETHOD() Extract (LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
HRESULT HandleMenuMsg2 ([in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam, [out] LRESULT *plResult)
 
HRESULT HandleMenuMsg ([in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam)
 
HRESULT QueryContextMenu ([in] HMENU hmenu, [in] UINT indexMenu, [in] UINT idCmdFirst, [in] UINT idCmdLast, [in] UINT uFlags)
 
HRESULT InvokeCommand ([in] LPCMINVOKECOMMANDINFO lpici)
 
HRESULT GetCommandString ([in] UINT_PTR idCmd, [in] UINT uType, [out] UINT *pwReserved, [out, size_is(cchMax)] LPSTR pszName, [in] UINT cchMax)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from IObjectWithSite
HRESULT SetSite ([in] IUnknown *pUnkSite)
 
HRESULT GetSite ([in] REFIID riid, [out, iid_is(riid)] PVOID *ppvSite)
 
- Public Member Functions inherited from IExtractIconW
HRESULT GetIconLocation ([in] UINT uFlags, [out, size_is(cchMax)] LPWSTR szIconFile, [in] UINT cchMax, [out] INT *piIndex, [out] UINT *pwFlags)
 
HRESULT Extract ([in] LPCWSTR pszFile, [in] UINT nIconIndex, [out] HICON *phiconLarge, [out] HICON *phiconSmall, [in] UINT nIconSize)
 

Private Attributes

PCUITEMID_CHILD m_pidl
 
CComPtr< IUnknownm_pUnknown
 
CComPtr< IOleCommandTargetm_lpOleCmd
 

Additional Inherited Members

- Public Types inherited from IContextMenu3
typedef IContextMenu3LPCONTEXTMENU3
 
- Public Types inherited from IContextMenu2
typedef IContextMenu2LPCONTEXTMENU2
 
- Public Types inherited from IContextMenu
typedef IContextMenuLPCONTEXTMENU
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFO CMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFOLPCMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMInvokeCommandInfoEx CMINVOKECOMMANDINFOEX
 
typedef struct IContextMenu::tagCMInvokeCommandInfoExLPCMINVOKECOMMANDINFOEX
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IObjectWithSite
typedef IObjectWithSiteLPOBJECTWITHSITE
 
- Public Types inherited from IExtractIconW
typedef IExtractIconWLPEXTRACTICONW
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Static Public Attributes inherited from IContextMenu
static const WCHAR CMDSTR_NEWFOLDERW [] = {'N','e','w','F','o','l','d','e','r',0}
 
static const WCHAR CMDSTR_VIEWLISTW [] = {'V','i','e','w','L','i','s','t',0}
 
static const WCHAR CMDSTR_VIEWDETAILSW [] = {'V','i','e','w','D','e','t','a','i','l','s',0}
 

Detailed Description

Definition at line 88 of file shfldr_netconnect.h.

Constructor & Destructor Documentation

◆ CNetConUiObject()

CNetConUiObject::CNetConUiObject ( )

Definition at line 382 of file shfldr_netconnect.cpp.

383 : m_pidl(NULL)
384{
385}
PCUITEMID_CHILD m_pidl
#define NULL
Definition: types.h:112

◆ ~CNetConUiObject()

CNetConUiObject::~CNetConUiObject ( )

Definition at line 387 of file shfldr_netconnect.cpp.

388{
389}

Member Function Documentation

◆ Extract()

HRESULT WINAPI CNetConUiObject::Extract ( LPCWSTR  pszFile,
UINT  nIconIndex,
HICON phiconLarge,
HICON phiconSmall,
UINT  nIconSize 
)
override

Implements IExtractIconW.

Definition at line 756 of file shfldr_netconnect.cpp.

762{
763 return SHDefExtractIconW(pszFile, nIconIndex, 0, phiconLarge, phiconSmall, nIconSize);
764}
HRESULT WINAPI SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
Definition: iconcache.cpp:1009

◆ GetCommandString()

HRESULT WINAPI CNetConUiObject::GetCommandString ( UINT_PTR  idCmd,
UINT  uType,
UINT pwReserved,
LPSTR  pszName,
UINT  cchMax 
)
override

Implements IContextMenu.

Definition at line 674 of file shfldr_netconnect.cpp.

680{
681 return E_FAIL;
682}
#define E_FAIL
Definition: ddrawi.h:102

◆ GetIconLocation()

HRESULT WINAPI CNetConUiObject::GetIconLocation ( UINT  uFlags,
LPWSTR  szIconFile,
UINT  cchMax,
int piIndex,
UINT pwFlags 
)
override

Definition at line 724 of file shfldr_netconnect.cpp.

730{
731 *pwFlags = 0;
733 {
734 ERR("GetModuleFileNameW failed\n");
735 return E_FAIL;
736 }
737
739 if (!pdata)
740 {
741 ERR("Got invalid pidl\n");
742 return E_FAIL;
743 }
744
745 if (pdata->Status == NCS_CONNECTED || pdata->Status == NCS_CONNECTING)
746 *piIndex = -IDI_NET_IDLE;
747 else
748 *piIndex = -IDI_NET_OFF;
749
750 return S_OK;
751}
UINT cchMax
#define ERR(fmt,...)
Definition: debug.h:113
#define IDI_NET_OFF
Definition: resource.h:11
#define IDI_NET_IDLE
Definition: resource.h:10
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
PNETCONIDSTRUCT ILGetConnData(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:10
#define S_OK
Definition: intsafe.h:52
static PROTOCOLDATA * pdata
Definition: protocol.c:158
@ NCS_CONNECTING
Definition: netcon.h:40
@ NCS_CONNECTED
Definition: netcon.h:41
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12

◆ GetInfoFlags()

HRESULT WINAPI CNetConUiObject::GetInfoFlags ( DWORD pdwFlags)
override

Definition at line 851 of file shfldr_netconnect.cpp.

852{
853 *pdwFlags = 0;
854
855 return S_OK;
856}

◆ GetInfoTip()

HRESULT WINAPI CNetConUiObject::GetInfoTip ( DWORD  dwFlags,
WCHAR **  ppwszTip 
)
override

Definition at line 863 of file shfldr_netconnect.cpp.

864{
865 *ppwszTip = NULL;
866 return S_OK;
867}

◆ GetSite()

HRESULT WINAPI CNetConUiObject::GetSite ( REFIID  iid,
void **  ppvSite 
)
override

Definition at line 704 of file shfldr_netconnect.cpp.

705{
706 if (!m_pUnknown)
707 {
708 *ppvSite = NULL;
709 return E_FAIL;
710 }
711
712 return m_pUnknown->QueryInterface(riid, ppvSite);
713}
CComPtr< IUnknown > m_pUnknown
REFIID riid
Definition: atlbase.h:39

◆ HandleMenuMsg()

HRESULT WINAPI CNetConUiObject::HandleMenuMsg ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
override

Implements IContextMenu2.

Definition at line 687 of file shfldr_netconnect.cpp.

691{
692 return E_NOTIMPL;
693}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ HandleMenuMsg2()

HRESULT WINAPI CNetConUiObject::HandleMenuMsg2 ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT plResult 
)
override

Implements IContextMenu3.

Definition at line 695 of file shfldr_netconnect.cpp.

700{
701 return E_NOTIMPL;
702}

◆ Initialize()

HRESULT WINAPI CNetConUiObject::Initialize ( PCUITEMID_CHILD  pidl,
IOleCommandTarget lpOleCmd 
)

Definition at line 391 of file shfldr_netconnect.cpp.

392{
393 m_pidl = pidl;
394 m_lpOleCmd = lpOleCmd;
395 return S_OK;
396}
CComPtr< IOleCommandTarget > m_lpOleCmd

◆ InvokeCommand()

HRESULT WINAPI CNetConUiObject::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpici)
override

Implements IContextMenu.

Definition at line 608 of file shfldr_netconnect.cpp.

609{
610 UINT CmdId;
611
612 /* We should get this when F2 is pressed in explorer */
613 if (HIWORD(lpcmi->lpVerb) && !strcmp(lpcmi->lpVerb, "rename"))
614 lpcmi->lpVerb = MAKEINTRESOURCEA(IDS_NET_RENAME);
615
616 if (HIWORD(lpcmi->lpVerb) || LOWORD(lpcmi->lpVerb) > 7)
617 {
618 FIXME("Got invalid command\n");
619 return E_NOTIMPL;
620 }
621
622 CmdId = LOWORD(lpcmi->lpVerb) + IDS_NET_ACTIVATE;
623
624 switch(CmdId)
625 {
626 case IDS_NET_RENAME:
627 {
628 HRESULT hr;
631 if (SUCCEEDED(hr))
632 {
633 SVSIF selFlags = SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT;
634 psv->SelectItem(m_pidl, selFlags);
635 }
636
637 return S_OK;
638 }
639 case IDS_NET_STATUS:
640 {
641 return ShowNetConnectionStatus(m_lpOleCmd, m_pidl, lpcmi->hwnd);
642 }
643 case IDS_NET_REPAIR:
645 case IDS_NET_DELETE:
646 FIXME("Command %u is not implemented\n", CmdId);
647 return E_NOTIMPL;
648 }
649
650 HRESULT hr;
652
653 hr = ILGetConnection(m_pidl, &pCon);
655 return hr;
656
657 switch(CmdId)
658 {
659 case IDS_NET_ACTIVATE:
660 return pCon->Connect();
662 return pCon->Disconnect();
664 return ShowNetConnectionProperties(pCon, lpcmi->hwnd);
665 }
666
667 return E_NOTIMPL;
668}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define FIXME(fmt,...)
Definition: debug.h:114
#define IDS_NET_DELETE
Definition: resource.h:93
#define IDS_NET_STATUS
Definition: resource.h:90
#define IDS_NET_PROPERTIES
Definition: resource.h:95
#define IDS_NET_DEACTIVATE
Definition: resource.h:89
#define IDS_NET_RENAME
Definition: resource.h:94
#define IDS_NET_REPAIR
Definition: resource.h:91
#define IDS_NET_ACTIVATE
Definition: resource.h:88
#define IDS_NET_CREATELINK
Definition: resource.h:92
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1497
HRESULT ILGetConnection(PCITEMID_CHILD pidl, INetConnection **pItem)
Definition: enumlist.cpp:77
#define SUCCEEDED(hr)
Definition: intsafe.h:50
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
HRESULT ShowNetConnectionStatus(IOleCommandTarget *lpOleCmd, PCUITEMID_CHILD pidl, HWND hwnd)
HRESULT ShowNetConnectionProperties(INetConnection *pNetConnect, HWND hwnd)
HRESULT hr
Definition: shlfolder.c:183
#define SID_IFolderView
#define HIWORD(l)
Definition: typedefs.h:247
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define IID_PPV_ARG(Itype, ppType)

◆ QueryContextMenu()

HRESULT WINAPI CNetConUiObject::QueryContextMenu ( HMENU  hmenu,
UINT  indexMenu,
UINT  idCmdFirst,
UINT  idCmdLast,
UINT  uFlags 
)
override

Implements IContextMenu.

Definition at line 446 of file shfldr_netconnect.cpp.

452{
454 if (!pdata)
455 {
456 ERR("Got invalid pidl\n");
457 return E_FAIL;
458 }
459
460 if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED || pdata->Status == NCS_DISCONNECTED)
462 else
463 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 1, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DEACTIVATE), MFS_ENABLED);
464
465 if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED || pdata->Status == NCS_DISCONNECTED)
466 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_GRAYED);
467 else if (pdata->Status == NCS_CONNECTED)
468 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_DEFAULT);
469 else
470 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_ENABLED);
471
472 if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED)
473 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 3, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_GRAYED);
474 else
475 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 3, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_ENABLED);
476
477 _InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
478 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 4, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_CREATELINK), MFS_ENABLED);
479
480 if (pdata->dwCharacter & NCCF_ALLOW_REMOVAL)
481 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 5, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_ENABLED);
482 else
483 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 5, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_GRAYED);
484
485 if (pdata->dwCharacter & NCCF_ALLOW_RENAME)
486 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 6, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_ENABLED);
487 else
488 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 6, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_GRAYED);
489
490 _InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
491 if (pdata->Status == NCS_CONNECTED)
492 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 7, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_PROPERTIES), MFS_ENABLED);
493 else
494 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 7, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_PROPERTIES), MFS_DEFAULT);
495
496 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 9);
497}
#define TRUE
Definition: types.h:120
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
@ NCCF_ALLOW_REMOVAL
Definition: netcon.h:18
@ NCCF_ALLOW_RENAME
Definition: netcon.h:19
@ NCS_MEDIA_DISCONNECTED
Definition: netcon.h:46
@ NCS_DISCONNECTED
Definition: netcon.h:39
@ NCS_HARDWARE_DISABLED
Definition: netcon.h:44
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define MFT_SEPARATOR
Definition: winuser.h:744
#define MFS_DEFAULT
Definition: winuser.h:748
#define MFS_GRAYED
Definition: winuser.h:751
#define MFS_ENABLED
Definition: winuser.h:750
#define MFT_STRING
Definition: winuser.h:746
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ SetSite()

HRESULT WINAPI CNetConUiObject::SetSite ( IUnknown punk)
override

Implements IObjectWithSite.

Definition at line 715 of file shfldr_netconnect.cpp.

716{
717 m_pUnknown = pUnkSite;
718 return S_OK;
719}

Member Data Documentation

◆ m_lpOleCmd

CComPtr<IOleCommandTarget> CNetConUiObject::m_lpOleCmd
private

Definition at line 98 of file shfldr_netconnect.h.

Referenced by Initialize(), and InvokeCommand().

◆ m_pidl

PCUITEMID_CHILD CNetConUiObject::m_pidl
private

Definition at line 96 of file shfldr_netconnect.h.

Referenced by GetIconLocation(), Initialize(), InvokeCommand(), and QueryContextMenu().

◆ m_pUnknown

CComPtr<IUnknown> CNetConUiObject::m_pUnknown
private

Definition at line 97 of file shfldr_netconnect.h.

Referenced by GetSite(), InvokeCommand(), and SetSite().


The documentation for this class was generated from the following files: