ReactOS  0.4.14-dev-552-g2fad488
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)
 
virtual HRESULT WINAPI QueryContextMenu (HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
 
virtual HRESULT WINAPI InvokeCommand (LPCMINVOKECOMMANDINFO lpici)
 
virtual HRESULT WINAPI GetCommandString (UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax)
 
virtual HRESULT WINAPI HandleMenuMsg (UINT uMsg, WPARAM wParam, LPARAM lParam)
 
virtual HRESULT WINAPI HandleMenuMsg2 (UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
 
virtual HRESULT WINAPI SetSite (IUnknown *punk)
 
virtual HRESULT WINAPI GetSite (REFIID iid, void **ppvSite)
 
virtual HRESULT WINAPI GetInfoFlags (DWORD *pdwFlags)
 
virtual HRESULT WINAPI GetInfoTip (DWORD dwFlags, WCHAR **ppwszTip)
 
virtual HRESULT STDMETHODCALLTYPE GetIconLocation (UINT uFlags, LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
 
virtual HRESULT STDMETHODCALLTYPE Extract (LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
 
- 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 ()
 
- 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 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)
 

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 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
 
- Public Attributes inherited from IContextMenu
CMIC_MASK_NOZONECHECKS typedef IContextMenuLPCONTEXTMENU
 
- Static Public Attributes inherited from IContextMenu
static CMDSTR_VIEWDETAILSW(const WCHAR []) 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 402 of file shfldr_netconnect.cpp.

403  : m_pidl(NULL)
404 {
405 }
smooth NULL
Definition: ftsmooth.c:416
PCUITEMID_CHILD m_pidl

◆ ~CNetConUiObject()

CNetConUiObject::~CNetConUiObject ( )

Definition at line 407 of file shfldr_netconnect.cpp.

408 {
409 }

Member Function Documentation

◆ Extract()

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

Implements IExtractIconW.

Definition at line 776 of file shfldr_netconnect.cpp.

782 {
783  return SHDefExtractIconW(pszFile, nIconIndex, 0, phiconLarge, phiconSmall, nIconSize);
784 }
HRESULT WINAPI SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
Definition: iconcache.cpp:1020

◆ GetCommandString()

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

Implements IContextMenu.

Definition at line 694 of file shfldr_netconnect.cpp.

700 {
701  return E_FAIL;
702 }
#define E_FAIL
Definition: ddrawi.h:102

◆ GetIconLocation()

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

Definition at line 744 of file shfldr_netconnect.cpp.

750 {
751  *pwFlags = 0;
752  if (!GetModuleFileNameW(netshell_hInstance, szIconFile, cchMax))
753  {
754  ERR("GetModuleFileNameW failed\n");
755  return E_FAIL;
756  }
757 
759  if (!pdata)
760  {
761  ERR("Got invalid pidl!\n");
762  return E_FAIL;
763  }
764 
765  if (pdata->Status == NCS_CONNECTED || pdata->Status == NCS_CONNECTING)
766  *piIndex = -IDI_NET_IDLE;
767  else
768  *piIndex = -IDI_NET_OFF;
769 
770  return S_OK;
771 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
#define IDI_NET_OFF
Definition: resource.h:11
#define E_FAIL
Definition: ddrawi.h:102
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
PNETCONIDSTRUCT ILGetConnData(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:10
static PROTOCOLDATA * pdata
Definition: protocol.c:158
#define IDI_NET_IDLE
Definition: resource.h:10
UINT cchMax
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
PCUITEMID_CHILD m_pidl

◆ GetInfoFlags()

HRESULT WINAPI CNetConUiObject::GetInfoFlags ( DWORD pdwFlags)
virtual

Definition at line 871 of file shfldr_netconnect.cpp.

872 {
873  *pdwFlags = 0;
874 
875  return S_OK;
876 }
#define S_OK
Definition: intsafe.h:59

◆ GetInfoTip()

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

Definition at line 883 of file shfldr_netconnect.cpp.

884 {
885  *ppwszTip = NULL;
886  return S_OK;
887 }
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59

◆ GetSite()

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

Definition at line 724 of file shfldr_netconnect.cpp.

725 {
726  if (!m_pUnknown)
727  {
728  *ppvSite = NULL;
729  return E_FAIL;
730  }
731 
732  return m_pUnknown->QueryInterface(riid, ppvSite);
733 }
REFIID riid
Definition: precomp.h:44
#define E_FAIL
Definition: ddrawi.h:102
CComPtr< IUnknown > m_pUnknown
smooth NULL
Definition: ftsmooth.c:416

◆ HandleMenuMsg()

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

Implements IContextMenu2.

Definition at line 707 of file shfldr_netconnect.cpp.

711 {
712  return E_NOTIMPL;
713 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ HandleMenuMsg2()

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

Implements IContextMenu3.

Definition at line 715 of file shfldr_netconnect.cpp.

720 {
721  return E_NOTIMPL;
722 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Initialize()

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

Definition at line 411 of file shfldr_netconnect.cpp.

412 {
413  m_pidl = pidl;
414  m_lpOleCmd = lpOleCmd;
415  return S_OK;
416 }
#define S_OK
Definition: intsafe.h:59
PCUITEMID_CHILD m_pidl
CComPtr< IOleCommandTarget > m_lpOleCmd

◆ InvokeCommand()

HRESULT WINAPI CNetConUiObject::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpici)
virtual

Implements IContextMenu.

Definition at line 628 of file shfldr_netconnect.cpp.

629 {
630  UINT CmdId;
631 
632  /* We should get this when F2 is pressed in explorer */
633  if (HIWORD(lpcmi->lpVerb) && !strcmp(lpcmi->lpVerb, "rename"))
634  lpcmi->lpVerb = MAKEINTRESOURCEA(IDS_NET_RENAME);
635 
636  if (HIWORD(lpcmi->lpVerb) || LOWORD(lpcmi->lpVerb) > 7)
637  {
638  FIXME("Got invalid command\n");
639  return E_NOTIMPL;
640  }
641 
642  CmdId = LOWORD(lpcmi->lpVerb) + IDS_NET_ACTIVATE;
643 
644  switch(CmdId)
645  {
646  case IDS_NET_RENAME:
647  {
648  HRESULT hr;
651  if (SUCCEEDED(hr))
652  {
653  SVSIF selFlags = SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT;
654  psv->SelectItem(m_pidl, selFlags);
655  }
656 
657  return S_OK;
658  }
659  case IDS_NET_STATUS:
660  {
661  return ShowNetConnectionStatus(m_lpOleCmd, m_pidl, lpcmi->hwnd);
662  }
663  case IDS_NET_REPAIR:
664  case IDS_NET_CREATELINK:
665  case IDS_NET_DELETE:
666  FIXME("Command %u is not implemented\n", CmdId);
667  return E_NOTIMPL;
668  }
669 
670  HRESULT hr;
672 
673  hr = ILGetConnection(m_pidl, &pCon);
674  if (FAILED_UNEXPECTEDLY(hr))
675  return hr;
676 
677  switch(CmdId)
678  {
679  case IDS_NET_ACTIVATE:
680  return pCon->Connect();
681  case IDS_NET_DEACTIVATE:
682  return pCon->Disconnect();
683  case IDS_NET_PROPERTIES:
684  return ShowNetConnectionProperties(pCon, lpcmi->hwnd);
685  }
686 
687  return E_NOTIMPL;
688 }
#define IDS_NET_REPAIR
Definition: resource.h:91
HRESULT ILGetConnection(PCITEMID_CHILD pidl, INetConnection **pItem)
Definition: enumlist.cpp:77
HRESULT hr
Definition: shlfolder.c:183
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define IDS_NET_DEACTIVATE
Definition: resource.h:89
#define SID_IFolderView
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
#define IDS_NET_DELETE
Definition: resource.h:93
CComPtr< IUnknown > m_pUnknown
#define FIXME(fmt,...)
Definition: debug.h:110
#define IDS_NET_CREATELINK
Definition: resource.h:92
#define IDS_NET_STATUS
Definition: resource.h:90
#define IDS_NET_ACTIVATE
Definition: resource.h:88
HRESULT ShowNetConnectionStatus(IOleCommandTarget *lpOleCmd, PCUITEMID_CHILD pidl, HWND hwnd)
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define IDS_NET_PROPERTIES
Definition: resource.h:95
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
PCUITEMID_CHILD m_pidl
#define HIWORD(l)
Definition: typedefs.h:246
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CComPtr< IOleCommandTarget > m_lpOleCmd
#define IDS_NET_RENAME
Definition: resource.h:94
#define LOWORD(l)
Definition: pedump.c:82
HRESULT ShowNetConnectionProperties(INetConnection *pNetConnect, HWND hwnd)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ QueryContextMenu()

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

Implements IContextMenu.

Definition at line 466 of file shfldr_netconnect.cpp.

472 {
474  if (!pdata)
475  {
476  ERR("Got invalid pidl!\n");
477  return E_FAIL;
478  }
479 
480  if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED || pdata->Status == NCS_DISCONNECTED)
481  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_ACTIVATE), MFS_DEFAULT);
482  else
483  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 1, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DEACTIVATE), MFS_ENABLED);
484 
485  if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED || pdata->Status == NCS_DISCONNECTED)
486  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_GRAYED);
487  else if (pdata->Status == NCS_CONNECTED)
488  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_DEFAULT);
489  else
490  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_ENABLED);
491 
492  if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED)
493  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 3, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_GRAYED);
494  else
495  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 3, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_ENABLED);
496 
497  _InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
498  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 4, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_CREATELINK), MFS_ENABLED);
499 
500  if (pdata->dwCharacter & NCCF_ALLOW_REMOVAL)
501  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 5, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_ENABLED);
502  else
503  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 5, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_GRAYED);
504 
505  if (pdata->dwCharacter & NCCF_ALLOW_RENAME)
506  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 6, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_ENABLED);
507  else
508  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 6, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_GRAYED);
509 
510  _InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
511  if (pdata->Status == NCS_CONNECTED)
512  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 7, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_PROPERTIES), MFS_ENABLED);
513  else
514  _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 7, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_PROPERTIES), MFS_DEFAULT);
515 
516  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 9);
517 }
#define IDS_NET_REPAIR
Definition: resource.h:91
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define MFT_STRING
Definition: winuser.h:741
#define TRUE
Definition: types.h:120
#define IDS_NET_DEACTIVATE
Definition: resource.h:89
#define MFS_DEFAULT
Definition: winuser.h:743
#define E_FAIL
Definition: ddrawi.h:102
#define IDS_NET_DELETE
Definition: resource.h:93
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define MFS_ENABLED
Definition: winuser.h:745
#define IDS_NET_CREATELINK
Definition: resource.h:92
smooth NULL
Definition: ftsmooth.c:416
#define IDS_NET_STATUS
Definition: resource.h:90
#define IDS_NET_ACTIVATE
Definition: resource.h:88
PNETCONIDSTRUCT ILGetConnData(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:10
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
static PROTOCOLDATA * pdata
Definition: protocol.c:158
#define MFT_SEPARATOR
Definition: winuser.h:739
#define IDS_NET_PROPERTIES
Definition: resource.h:95
#define MFS_GRAYED
Definition: winuser.h:746
#define ERR(fmt,...)
Definition: debug.h:109
PCUITEMID_CHILD m_pidl
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDS_NET_RENAME
Definition: resource.h:94

◆ SetSite()

HRESULT WINAPI CNetConUiObject::SetSite ( IUnknown punk)
virtual

Implements IObjectWithSite.

Definition at line 735 of file shfldr_netconnect.cpp.

736 {
737  m_pUnknown = pUnkSite;
738  return S_OK;
739 }
CComPtr< IUnknown > m_pUnknown
#define S_OK
Definition: intsafe.h:59

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: