ReactOS  0.4.15-dev-4603-gb922b6d
CLanStatus Class Reference

#include <lanstatusui.h>

Inheritance diagram for CLanStatus:
Collaboration diagram for CLanStatus:

Public Member Functions

 CLanStatus ()
 
virtual HRESULT WINAPI QueryStatus (const GUID *pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
 
virtual HRESULT WINAPI Exec (const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 
- 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 IOleCommandTarget
HRESULT QueryStatus ([in, unique] const GUID *pguidCmdGroup, [in] ULONG cCmds, [in, out, size_is(cCmds)] OLECMD prgCmds[], [in, out, unique] OLECMDTEXT *pCmdText)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Member Functions

HRESULT InitializeNetTaskbarNotifications ()
 
HRESULT ShowStatusDialogByCLSID (const GUID *pguidCmdGroup)
 

Private Attributes

CComPtr< INetConnectionManager > m_lpNetMan
 
NOTIFICATION_ITEMm_pHead
 

Additional Inherited Members

- Public Types inherited from IOleCommandTarget
enum  OLECMDF {
  OLECMDF_SUPPORTED = 0x1, OLECMDF_ENABLED = 0x2, OLECMDF_LATCHED = 0x4, OLECMDF_NINCHED = 0x8,
  OLECMDF_INVISIBLE = 0x10, OLECMDF_DEFHIDEONCTXTMENU = 0x20
}
 
enum  OLECMDTEXTF { OLECMDTEXTF_NONE = 0, OLECMDTEXTF_NAME = 1, OLECMDTEXTF_STATUS = 2 }
 
enum  OLECMDEXECOPT { OLECMDEXECOPT_DODEFAULT = 0, OLECMDEXECOPT_PROMPTUSER = 1, OLECMDEXECOPT_DONTPROMPTUSER = 2, OLECMDEXECOPT_SHOWHELP = 3 }
 
enum  OLECMDID {
  OLECMDID_OPEN = 1, OLECMDID_NEW = 2, OLECMDID_SAVE = 3, OLECMDID_SAVEAS = 4,
  OLECMDID_SAVECOPYAS = 5, OLECMDID_PRINT = 6, OLECMDID_PRINTPREVIEW = 7, OLECMDID_PAGESETUP = 8,
  OLECMDID_SPELL = 9, OLECMDID_PROPERTIES = 10, OLECMDID_CUT = 11, OLECMDID_COPY = 12,
  OLECMDID_PASTE = 13, OLECMDID_PASTESPECIAL = 14, OLECMDID_UNDO = 15, OLECMDID_REDO = 16,
  OLECMDID_SELECTALL = 17, OLECMDID_CLEARSELECTION = 18, OLECMDID_ZOOM = 19, OLECMDID_GETZOOMRANGE = 20,
  OLECMDID_UPDATECOMMANDS = 21, OLECMDID_REFRESH = 22, OLECMDID_STOP = 23, OLECMDID_HIDETOOLBARS = 24,
  OLECMDID_SETPROGRESSMAX = 25, OLECMDID_SETPROGRESSPOS = 26, OLECMDID_SETPROGRESSTEXT = 27, OLECMDID_SETTITLE = 28,
  OLECMDID_SETDOWNLOADSTATE = 29, OLECMDID_STOPDOWNLOAD = 30, OLECMDID_ONTOOLBARACTIVATED = 31, OLECMDID_FIND = 32,
  OLECMDID_DELETE = 33, OLECMDID_HTTPEQUIV = 34, OLECMDID_HTTPEQUIV_DONE = 35, OLECMDID_ENABLE_INTERACTION = 36,
  OLECMDID_ONUNLOAD = 37, OLECMDID_PROPERTYBAG2 = 38, OLECMDID_PREREFRESH = 39, OLECMDID_SHOWSCRIPTERROR = 40,
  OLECMDID_SHOWMESSAGE = 41, OLECMDID_SHOWFIND = 42, OLECMDID_SHOWPAGESETUP = 43, OLECMDID_SHOWPRINT = 44,
  OLECMDID_CLOSE = 45, OLECMDID_ALLOWUILESSSAVEAS = 46, OLECMDID_DONTDOWNLOADCSS = 47, OLECMDID_UPDATEPAGESTATUS = 48,
  OLECMDID_PRINT2 = 49, OLECMDID_PRINTPREVIEW2 = 50, OLECMDID_SETPRINTTEMPLATE = 51, OLECMDID_GETPRINTTEMPLATE = 52,
  OLECMDID_PAGEACTIONBLOCKED = 55, OLECMDID_PAGEACTIONUIQUERY = 56, OLECMDID_FOCUSVIEWCONTROLS = 57, OLECMDID_FOCUSVIEWCONTROLSQUERY = 58,
  OLECMDID_SHOWPAGEACTIONMENU = 59, OLECMDID_ADDTRAVELENTRY = 60, OLECMDID_UPDATETRAVELENTRY = 61, OLECMDID_UPDATEBACKFORWARDSTATE = 62,
  OLECMDID_OPTICAL_ZOOM = 63, OLECMDID_OPTICAL_GETZOOMRANGE = 64, OLECMDID_WINDOWSTATECHANGED = 65, OLECMDID_ACTIVEXINSTALLSCOPE = 66,
  OLECMDID_UPDATETRAVELENTRY_DATARECOVERY = 67, OLECMDID_SHOWTASKDLG = 68, OLECMDID_POPSTATEEVENT = 69, OLECMDID_VIEWPORT_MODE = 70,
  OLECMDID_LAYOUT_VIEWPORT_WIDTH = 71, OLECMDID_VISUAL_VIEWPORT_EXCLUDE_BOTTOM = 72, OLECMDID_USER_OPTICAL_ZOOM = 73, OLECMDID_PAGEAVAILABLE = 74,
  OLECMDID_GETUSERSCALABLE = 75, OLECMDID_UPDATE_CARET = 76, OLECMDID_ENABLE_VISIBILITY = 77, OLECMDID_MEDIA_PLAYBACK = 78
}
 
typedef IOleCommandTargetLPOLECOMMANDTARGET
 
typedef enum IOleCommandTarget::OLECMDF OLECMDF
 
typedef struct IOleCommandTarget::_tagOLECMD OLECMD
 
typedef struct IOleCommandTarget::_tagOLECMDTEXT OLECMDTEXT
 
typedef enum IOleCommandTarget::OLECMDTEXTF OLECMDTEXTF
 
typedef enum IOleCommandTarget::OLECMDEXECOPT OLECMDEXECOPT
 
typedef enum IOleCommandTarget::OLECMDID OLECMDID
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- 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
 

Detailed Description

Definition at line 34 of file lanstatusui.h.

Constructor & Destructor Documentation

◆ CLanStatus()

CLanStatus::CLanStatus ( )

Definition at line 12 of file lanstatusui.cpp.

12  :
14  m_pHead(NULL)
15 {
16 }
NOTIFICATION_ITEM * m_pHead
Definition: lanstatusui.h:51
CComPtr< INetConnectionManager > m_lpNetMan
Definition: lanstatusui.h:50
#define NULL
Definition: types.h:112

Member Function Documentation

◆ Exec()

HRESULT WINAPI CLanStatus::Exec ( const GUID pguidCmdGroup,
DWORD  nCmdID,
DWORD  nCmdexecopt,
VARIANT pvaIn,
VARIANT pvaOut 
)
virtual

Implements IOleCommandTarget.

Definition at line 1039 of file lanstatusui.cpp.

1045 {
1046  if (pguidCmdGroup)
1047  {
1048  if (IsEqualGUID(*pguidCmdGroup, CGID_ShellServiceObject))
1049  {
1051  }
1052  else
1053  {
1054  /* invoke status dialog */
1055  return ShowStatusDialogByCLSID(pguidCmdGroup);
1056  }
1057  }
1058  return S_OK;
1059 }
#define S_OK
Definition: intsafe.h:52
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
HRESULT ShowStatusDialogByCLSID(const GUID *pguidCmdGroup)
HRESULT InitializeNetTaskbarNotifications()

◆ InitializeNetTaskbarNotifications()

HRESULT CLanStatus::InitializeNetTaskbarNotifications ( )
private

Definition at line 864 of file lanstatusui.cpp.

865 {
867  HWND hwndDlg;
870  CComPtr<INetConnection> pNetCon;
871  NETCON_PROPERTIES* pProps;
872  HRESULT hr;
873  ULONG Count;
874  ULONG Index;
875  NOTIFICATION_ITEM * pItem, *pLast = NULL;
876  LANSTATUSUI_CONTEXT * pContext;
877 
878  TRACE("InitializeNetTaskbarNotifications\n");
879 
880  if (m_pHead)
881  {
882  pItem = m_pHead;
883  while (pItem)
884  {
885  hr = pItem->pNet->GetProperties(&pProps);
886  if (SUCCEEDED(hr))
887  {
888  ZeroMemory(&nid, sizeof(nid));
889  nid.cbSize = sizeof(nid);
890  nid.uID = pItem->uID;
891  nid.hWnd = pItem->hwndDlg;
892  nid.uFlags = NIF_STATE;
893  if (pProps->dwCharacter & NCCF_SHOW_ICON)
894  nid.dwState = 0;
895  else
896  nid.dwState = NIS_HIDDEN;
897 
898  nid.dwStateMask = NIS_HIDDEN;
900  NcFreeNetconProperties(pProps);
901  }
902  pItem = pItem->pNext;
903  }
904  return S_OK;
905  }
906  /* get an instance to of IConnectionManager */
907  hr = CNetConnectionManager_CreateInstance(IID_PPV_ARG(INetConnectionManager, &pNetConMan));
908  if (FAILED_UNEXPECTEDLY(hr))
909  return hr;
910 
911  hr = pNetConMan->EnumConnections(NCME_DEFAULT, &pEnumCon);
912  if (FAILED_UNEXPECTEDLY(hr))
913  return hr;
914 
915  Index = 1;
916  while (TRUE)
917  {
918  pNetCon.Release();
919  hr = pEnumCon->Next(1, &pNetCon, &Count);
920  if (hr != S_OK)
921  break;
922 
923  TRACE("new connection\n");
924  pItem = static_cast<NOTIFICATION_ITEM*>(CoTaskMemAlloc(sizeof(NOTIFICATION_ITEM)));
925  if (!pItem)
926  break;
927 
928  pContext = static_cast<LANSTATUSUI_CONTEXT*>(CoTaskMemAlloc(sizeof(LANSTATUSUI_CONTEXT)));
929  if (!pContext)
930  {
931  CoTaskMemFree(pItem);
932  break;
933  }
934 
935  ZeroMemory(pContext, sizeof(LANSTATUSUI_CONTEXT));
936  pContext->uID = Index;
937  pContext->pNet = pNetCon;
938  pItem->uID = Index;
939  pItem->pNext = NULL;
940  pItem->pNet = pNetCon;
941  pNetCon->AddRef();
943  if (!hwndDlg)
944  {
945  ERR("CreateDialogParamW failed\n");
946  continue;
947  }
948 
949  ZeroMemory(&nid, sizeof(nid));
950  nid.cbSize = sizeof(nid);
951  nid.uID = Index++;
953  nid.uVersion = NOTIFYICON_VERSION;
955  nid.hWnd = hwndDlg;
956 
957  hr = pNetCon->GetProperties(&pProps);
958  if (SUCCEEDED(hr))
959  {
960  CopyMemory(&pItem->guidItem, &pProps->guidId, sizeof(GUID));
961  if (!(pProps->dwCharacter & NCCF_SHOW_ICON))
962  {
963  nid.dwState = NIS_HIDDEN;
964  nid.dwStateMask = NIS_HIDDEN;
965  nid.uFlags |= NIF_STATE;
966  }
967  if (pProps->Status == NCS_MEDIA_DISCONNECTED || pProps->Status == NCS_DISCONNECTED || pProps->Status == NCS_HARDWARE_DISABLED)
969  else if (pProps->Status == NCS_CONNECTED)
971 
972  if (nid.hIcon)
973  nid.uFlags |= NIF_ICON;
974 
975  wcscpy(nid.szTip, pProps->pszwName);
976  nid.uFlags |= NIF_TIP;
977  }
978  pContext->hwndStatusDlg = hwndDlg;
979  pItem->hwndDlg = hwndDlg;
980 
982  {
983  if (pLast)
984  pLast->pNext = pItem;
985  else
986  m_pHead = pItem;
987 
988  pLast = pItem;
989  Index++;
990  }
991  else
992  {
993  ERR("Shell_NotifyIconW failed\n");
994  CoTaskMemFree(pItem);
995  }
996 
997  if (nid.uFlags & NIF_ICON)
999  }
1000 
1001  m_lpNetMan = pNetConMan;
1002  return S_OK;
1003 }
NOTIFICATION_ITEM * m_pHead
Definition: lanstatusui.h:51
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define WM_SHOWSTATUSDLG
Definition: lanstatusui.h:6
#define NIF_MESSAGE
Definition: shellapi.h:102
INetConnection * pNet
Definition: lanstatusui.h:19
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
HRESULT hr
Definition: shlfolder.c:183
NOTIFYICONDATA nid
Definition: magnifier.c:44
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
#define IDI_NET_OFF
Definition: resource.h:11
#define ZeroMemory
Definition: winbase.h:1667
#define IID_PPV_ARG(Itype, ppType)
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
CComPtr< INetConnectionManager > m_lpNetMan
Definition: lanstatusui.h:50
DWORD dwStateMask
Definition: shellapi.h:237
if SUCCEEDED(hr)
CHAR szTip[128]
Definition: shellapi.h:235
#define NIF_TIP
Definition: shellapi.h:104
LONG_PTR LPARAM
Definition: windef.h:208
#define NIF_ICON
Definition: shellapi.h:103
int Count
Definition: noreturn.cpp:7
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
_In_ WDFCOLLECTION _In_ ULONG Index
#define IDI_NET_IDLE
Definition: resource.h:10
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define CopyMemory
Definition: winbase.h:1665
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
UINT uCallbackMessage
Definition: shellapi.h:229
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
HRESULT WINAPI CNetConnectionManager_CreateInstance(REFIID riid, LPVOID *ppv)
void Release()
Definition: atlcomcli.h:140
#define NULL
Definition: types.h:112
#define IDD_STATUS
Definition: resource.h:22
#define NIM_ADD
Definition: shellapi.h:91
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
NETCON_STATUS Status
Definition: netcon.h:86
unsigned int ULONG
Definition: retypes.h:1
INT_PTR CALLBACK LANStatusDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LoadIcon
Definition: winuser.h:5793
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW pnid)
Definition: systray.cpp:128
#define NIM_MODIFY
Definition: shellapi.h:92

Referenced by Exec().

◆ QueryStatus()

HRESULT WINAPI CLanStatus::QueryStatus ( const GUID pguidCmdGroup,
ULONG  cCmds,
OLECMD prgCmds,
OLECMDTEXT pCmdText 
)
virtual

Definition at line 1027 of file lanstatusui.cpp.

1032 {
1033  MessageBoxW(NULL, pCmdText->rgwz, L"IOleCommandTarget_fnQueryStatus", MB_OK);
1034  return E_NOTIMPL;
1035 }
#define L(x)
Definition: ntvdm.h:50
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784

◆ ShowStatusDialogByCLSID()

HRESULT CLanStatus::ShowStatusDialogByCLSID ( const GUID pguidCmdGroup)
private

Definition at line 1006 of file lanstatusui.cpp.

1007 {
1008  NOTIFICATION_ITEM *pItem;
1009 
1010  pItem = m_pHead;
1011  while (pItem)
1012  {
1013  if (IsEqualGUID(pItem->guidItem, *pguidCmdGroup))
1014  {
1015  SendMessageW(pItem->hwndDlg, WM_SHOWSTATUSDLG, 0, WM_LBUTTONDOWN);
1016  return S_OK;
1017  }
1018  pItem = pItem->pNext;
1019  }
1020 
1021  ERR("not found\n");
1022  return E_FAIL;
1023 }
NOTIFICATION_ITEM * m_pHead
Definition: lanstatusui.h:51
#define WM_SHOWSTATUSDLG
Definition: lanstatusui.h:6
#define WM_LBUTTONDOWN
Definition: winuser.h:1763
#define E_FAIL
Definition: ddrawi.h:102
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

Referenced by Exec().

Member Data Documentation

◆ m_lpNetMan

CComPtr<INetConnectionManager> CLanStatus::m_lpNetMan
private

Definition at line 50 of file lanstatusui.h.

Referenced by InitializeNetTaskbarNotifications().

◆ m_pHead

NOTIFICATION_ITEM* CLanStatus::m_pHead
private

Definition at line 51 of file lanstatusui.h.

Referenced by InitializeNetTaskbarNotifications(), and ShowStatusDialogByCLSID().


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