ReactOS 0.4.16-dev-199-g898cc56
CLanStatus Class Reference

#include <lanstatusui.h>

Inheritance diagram for CLanStatus:
Collaboration diagram for CLanStatus:

Public Member Functions

 CLanStatus ()
 
STDMETHOD() QueryStatus (const GUID *pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText) override
 
STDMETHOD() Exec (const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) 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 ()
 
- 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)
 
HRESULT Exec ([in, unique] const GUID *pguidCmdGroup, [in] DWORD nCmdID, [in] DWORD nCmdexecopt, [in, unique] VARIANT *pvaIn, [in, out, unique] VARIANT *pvaOut)
 
- 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 14 of file lanstatusui.cpp.

14 :
17{
18}
CComPtr< INetConnectionManager > m_lpNetMan
Definition: lanstatusui.h:50
NOTIFICATION_ITEM * m_pHead
Definition: lanstatusui.h:51
#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 
)
override

Implements IOleCommandTarget.

Definition at line 1054 of file lanstatusui.cpp.

1060{
1061 if (pguidCmdGroup)
1062 {
1063 if (IsEqualGUID(*pguidCmdGroup, CGID_ShellServiceObject))
1064 {
1066 }
1067 else
1068 {
1069 /* invoke status dialog */
1070 return ShowStatusDialogByCLSID(pguidCmdGroup);
1071 }
1072 }
1073 return S_OK;
1074}
HRESULT InitializeNetTaskbarNotifications()
HRESULT ShowStatusDialogByCLSID(const GUID *pguidCmdGroup)
#define S_OK
Definition: intsafe.h:52
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

◆ InitializeNetTaskbarNotifications()

HRESULT CLanStatus::InitializeNetTaskbarNotifications ( )
private

Definition at line 877 of file lanstatusui.cpp.

878{
880 HWND hwndDlg;
884 NETCON_PROPERTIES* pProps;
885 HRESULT hr;
886 ULONG Count;
887 ULONG Index;
888 NOTIFICATION_ITEM * pItem, *pLast = NULL;
889 LANSTATUSUI_CONTEXT * pContext;
890
891 TRACE("InitializeNetTaskbarNotifications\n");
892
893 if (m_pHead)
894 {
895 pItem = m_pHead;
896 while (pItem)
897 {
898 hr = pItem->pNet->GetProperties(&pProps);
899 if (SUCCEEDED(hr))
900 {
901 ZeroMemory(&nid, sizeof(nid));
902 nid.cbSize = sizeof(nid);
903 nid.uID = pItem->uID;
904 nid.hWnd = pItem->hwndDlg;
905 nid.uFlags = NIF_STATE;
906 if (pProps->dwCharacter & NCCF_SHOW_ICON)
907 nid.dwState = 0;
908 else
909 nid.dwState = NIS_HIDDEN;
910
911 nid.dwStateMask = NIS_HIDDEN;
914 }
915 pItem = pItem->pNext;
916 }
917 return S_OK;
918 }
919 /* get an instance to of IConnectionManager */
920 hr = CNetConnectionManager_CreateInstance(IID_PPV_ARG(INetConnectionManager, &pNetConMan));
922 return hr;
923
924 hr = pNetConMan->EnumConnections(NCME_DEFAULT, &pEnumCon);
926 return hr;
927
928 Index = 1;
929 while (TRUE)
930 {
931 pNetCon.Release();
932 hr = pEnumCon->Next(1, &pNetCon, &Count);
933 if (hr != S_OK)
934 break;
935
936 TRACE("new connection\n");
937 pItem = static_cast<NOTIFICATION_ITEM*>(CoTaskMemAlloc(sizeof(NOTIFICATION_ITEM)));
938 if (!pItem)
939 break;
940
941 pContext = static_cast<LANSTATUSUI_CONTEXT*>(CoTaskMemAlloc(sizeof(LANSTATUSUI_CONTEXT)));
942 if (!pContext)
943 {
944 CoTaskMemFree(pItem);
945 break;
946 }
947
948 ZeroMemory(pContext, sizeof(LANSTATUSUI_CONTEXT));
949 pContext->uID = Index;
950 pContext->pNet = pNetCon;
951 pContext->Status = -1;
952 pContext->dwAdapterIndex = Index;
953 pItem->uID = Index;
954 pItem->pNext = NULL;
955 pItem->pNet = pNetCon;
956 pItem->pNet->AddRef();
958 if (!hwndDlg)
959 {
960 ERR("CreateDialogParamW failed\n");
961 continue;
962 }
963
964 ZeroMemory(&nid, sizeof(nid));
965 nid.cbSize = sizeof(nid);
966 nid.uID = Index++;
968 nid.uVersion = NOTIFYICON_VERSION;
970 nid.hWnd = hwndDlg;
971
972 hr = pNetCon->GetProperties(&pProps);
973 if (SUCCEEDED(hr))
974 {
975 CopyMemory(&pItem->guidItem, &pProps->guidId, sizeof(GUID));
976 if (!(pProps->dwCharacter & NCCF_SHOW_ICON))
977 {
978 nid.dwState = NIS_HIDDEN;
979 nid.dwStateMask = NIS_HIDDEN;
980 nid.uFlags |= NIF_STATE;
981 }
982 if (pProps->Status == NCS_MEDIA_DISCONNECTED || pProps->Status == NCS_DISCONNECTED || pProps->Status == NCS_HARDWARE_DISABLED)
984 else if (pProps->Status == NCS_CONNECTED)
986
987 if (nid.hIcon)
989
990 wcscpy(nid.szTip, pProps->pszwName);
991 nid.uFlags |= NIF_TIP;
992 }
993 pContext->hwndStatusDlg = hwndDlg;
994 pItem->hwndDlg = hwndDlg;
995
997 {
998 if (pLast)
999 pLast->pNext = pItem;
1000 else
1001 m_pHead = pItem;
1002
1003 pLast = pItem;
1004 Index++;
1005 }
1006 else
1007 {
1008 ERR("Shell_NotifyIconW failed\n");
1009 CoTaskMemFree(pItem);
1010 }
1011
1012 if (nid.uFlags & NIF_ICON)
1014 }
1015
1016 m_lpNetMan = pNetConMan;
1017 return S_OK;
1018}
#define ERR(fmt,...)
Definition: precomp.h:57
void Release()
Definition: atlcomcli.h:170
HRESULT WINAPI CNetConnectionManager_CreateInstance(REFIID riid, LPVOID *ppv)
#define TRUE
Definition: types.h:120
#define IDD_STATUS
Definition: resource.h:22
#define IDI_NET_OFF
Definition: resource.h:11
#define IDI_NET_IDLE
Definition: resource.h:10
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define SUCCEEDED(hr)
Definition: intsafe.h:50
INT_PTR CALLBACK LANStatusDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define WM_SHOWSTATUSDLG
Definition: lanstatusui.h:6
NOTIFYICONDATA nid
Definition: magnifier.c:44
@ NCCF_SHOW_ICON
Definition: netcon.h:20
@ NCS_MEDIA_DISCONNECTED
Definition: netcon.h:46
@ NCS_CONNECTED
Definition: netcon.h:41
@ NCS_DISCONNECTED
Definition: netcon.h:39
@ NCS_HARDWARE_DISABLED
Definition: netcon.h:44
@ NCME_DEFAULT
Definition: netcon.h:10
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119
int Count
Definition: noreturn.cpp:7
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define NIM_MODIFY
Definition: shellapi.h:95
#define NIF_ICON
Definition: shellapi.h:106
#define NIF_MESSAGE
Definition: shellapi.h:105
#define NIM_ADD
Definition: shellapi.h:94
#define NIF_TIP
Definition: shellapi.h:107
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
INetConnection * pNet
Definition: lanstatusui.h:19
UINT uCallbackMessage
Definition: shellapi.h:231
DWORD dwStateMask
Definition: shellapi.h:239
CHAR szTip[128]
Definition: shellapi.h:237
NETCON_STATUS Status
Definition: netcon.h:86
BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW pnid)
Definition: systray.cpp:128
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
#define ZeroMemory
Definition: winbase.h:1736
#define CopyMemory
Definition: winbase.h:1734
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define LoadIcon
Definition: winuser.h:5825
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105
#define IID_PPV_ARG(Itype, ppType)

Referenced by Exec().

◆ QueryStatus()

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

Definition at line 1042 of file lanstatusui.cpp.

1047{
1048 MessageBoxW(NULL, pCmdText->rgwz, L"IOleCommandTarget_fnQueryStatus", MB_OK);
1049 return E_NOTIMPL;
1050}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define L(x)
Definition: ntvdm.h:50
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:793

◆ ShowStatusDialogByCLSID()

HRESULT CLanStatus::ShowStatusDialogByCLSID ( const GUID pguidCmdGroup)
private

Definition at line 1021 of file lanstatusui.cpp.

1022{
1023 NOTIFICATION_ITEM *pItem;
1024
1025 pItem = m_pHead;
1026 while (pItem)
1027 {
1028 if (IsEqualGUID(pItem->guidItem, *pguidCmdGroup))
1029 {
1030 SendMessageW(pItem->hwndDlg, WM_SHOWSTATUSDLG, 0, WM_LBUTTONUP);
1031 return S_OK;
1032 }
1033 pItem = pItem->pNext;
1034 }
1035
1036 ERR("not found\n");
1037 return E_FAIL;
1038}
#define E_FAIL
Definition: ddrawi.h:102
#define WM_LBUTTONUP
Definition: winuser.h:1780
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

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: