ReactOS  0.4.14-dev-50-g13bb5e2
shfldr_netconnect.cpp File Reference
#include "precomp.h"
Include dependency graph for shfldr_netconnect.cpp:

Go to the source code of this file.

Macros

#define MAX_PROPERTY_SHEET_PAGE   (10)
 
#define NETCONNECTSHELLVIEWCOLUMNS   6
 
#define COLUMN_NAME   0
 
#define COLUMN_TYPE   1
 
#define COLUMN_STATUS   2
 
#define COLUMN_DEVNAME   3
 
#define COLUMN_PHONE   4
 
#define COLUMN_OWNER   5
 

Functions

HRESULT ShowNetConnectionStatus (IOleCommandTarget *lpOleCmd, PCUITEMID_CHILD pidl, HWND hwnd)
 
void WINAPI _InsertMenuItemW (HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
 
BOOL CALLBACK PropSheetExCallback (HPROPSHEETPAGE hPage, LPARAM lParam)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
HRESULT ShowNetConnectionProperties (INetConnection *pNetConnect, HWND hwnd)
 

Variables

static const shvheader NetConnectSFHeader []
 

Macro Definition Documentation

◆ COLUMN_DEVNAME

#define COLUMN_DEVNAME   3

Definition at line 50 of file shfldr_netconnect.cpp.

◆ COLUMN_NAME

#define COLUMN_NAME   0

Definition at line 47 of file shfldr_netconnect.cpp.

◆ COLUMN_OWNER

#define COLUMN_OWNER   5

Definition at line 52 of file shfldr_netconnect.cpp.

◆ COLUMN_PHONE

#define COLUMN_PHONE   4

Definition at line 51 of file shfldr_netconnect.cpp.

◆ COLUMN_STATUS

#define COLUMN_STATUS   2

Definition at line 49 of file shfldr_netconnect.cpp.

◆ COLUMN_TYPE

#define COLUMN_TYPE   1

Definition at line 48 of file shfldr_netconnect.cpp.

◆ MAX_PROPERTY_SHEET_PAGE

#define MAX_PROPERTY_SHEET_PAGE   (10)

Definition at line 30 of file shfldr_netconnect.cpp.

◆ NETCONNECTSHELLVIEWCOLUMNS

#define NETCONNECTSHELLVIEWCOLUMNS   6

Definition at line 45 of file shfldr_netconnect.cpp.

Function Documentation

◆ _InsertMenuItemW()

void WINAPI _InsertMenuItemW ( HMENU  hmenu,
UINT  indexMenu,
BOOL  fByPosition,
UINT  wID,
UINT  fType,
LPCWSTR  dwTypeData,
UINT  fState 
)

Definition at line 418 of file shfldr_netconnect.cpp.

426 {
427  MENUITEMINFOW mii;
428  WCHAR szText[100];
429 
430  ZeroMemory(&mii, sizeof(mii));
431  mii.cbSize = sizeof(mii);
432  if (fType == MFT_SEPARATOR)
433  {
434  mii.fMask = MIIM_ID | MIIM_TYPE;
435  }
436  else if (fType == MFT_STRING)
437  {
438  mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
439  if ((ULONG_PTR)HIWORD((ULONG_PTR)dwTypeData) == 0)
440  {
441  if (LoadStringW(netshell_hInstance, LOWORD((ULONG_PTR)dwTypeData), szText, sizeof(szText)/sizeof(WCHAR)))
442  {
443  szText[(sizeof(szText)/sizeof(WCHAR))-1] = 0;
444  mii.dwTypeData = szText;
445  }
446  else
447  {
448  return;
449  }
450  }
451  else
452  {
453  mii.dwTypeData = (LPWSTR) dwTypeData;
454  }
455  mii.fState = fState;
456  }
457 
458  mii.wID = wID;
459  mii.fType = fType;
460  InsertMenuItemW( hmenu, indexMenu, fByPosition, &mii);
461 }
#define MFT_STRING
Definition: winuser.h:741
static HMENU hmenu
Definition: win.c:66
#define ZeroMemory
Definition: winbase.h:1635
LPWSTR dwTypeData
Definition: winuser.h:3243
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
uint32_t ULONG_PTR
Definition: typedefs.h:63
static const WCHAR szText[]
Definition: dialog.c:139
#define MIIM_STATE
Definition: winuser.h:716
#define MIIM_ID
Definition: winuser.h:717
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MFT_SEPARATOR
Definition: winuser.h:739
#define MIIM_TYPE
Definition: winuser.h:720
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
#define HIWORD(l)
Definition: typedefs.h:246
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LOWORD(l)
Definition: pedump.c:82

Referenced by CDrivesFolder::CallBack(), CDesktopFolder::CallBack(), CFSFolder::CallBack(), DrivesContextMenuCallback(), CCPLItemMenu::QueryContextMenu(), CNetConUiObject::QueryContextMenu(), and CRecycleBinItemContextMenu::QueryContextMenu().

◆ PropSheetExCallback()

BOOL CALLBACK PropSheetExCallback ( HPROPSHEETPAGE  hPage,
LPARAM  lParam 
)

Definition at line 521 of file shfldr_netconnect.cpp.

522 {
524 
525  if (pinfo->nPages < MAX_PROPERTY_SHEET_PAGE)
526  {
527  pinfo->phpage[pinfo->nPages++] = hPage;
528  return TRUE;
529  }
530  return FALSE;
531 }
#define TRUE
Definition: types.h:120
HPROPSHEETPAGE * phpage
Definition: prsht.h:291
#define MAX_PROPERTY_SHEET_PAGE
LPARAM lParam
Definition: combotst.c:139

Referenced by ShowNetConnectionProperties().

◆ PropSheetProc()

static int CALLBACK PropSheetProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
static

Definition at line 553 of file shfldr_netconnect.cpp.

554 {
555  // NOTE: This callback is needed to set large icon correctly.
556  HICON hIcon;
557  switch (uMsg)
558  {
559  case PSCB_INITIALIZED:
560  {
562  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
563  break;
564  }
565  }
566  return 0;
567 }
static HICON
Definition: imagelist.c:84
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
LONG_PTR LPARAM
Definition: windef.h:208
#define IDI_SHELL_NETWORK_FOLDER
Definition: resource.h:5
#define PSCB_INITIALIZED
Definition: prsht.h:75
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by ShowNetConnectionProperties().

◆ ShowNetConnectionProperties()

HRESULT ShowNetConnectionProperties ( INetConnection pNetConnect,
HWND  hwnd 
)

Definition at line 570 of file shfldr_netconnect.cpp.

573 {
574  HRESULT hr;
575  CLSID ClassID;
576  PROPSHEETHEADERW pinfo;
579  NETCON_PROPERTIES * pProperties;
580 
581  if (pNetConnect->GetProperties(&pProperties) != S_OK)
582  return E_FAIL;
583 
584  hr = pNetConnect->GetUiObjectClassId(&ClassID);
585  if (FAILED(hr))
586  {
587  NcFreeNetconProperties(pProperties);
588  return hr;
589  }
590 
591  hr = CoCreateInstance(ClassID, NULL, CLSCTX_INPROC_SERVER, IID_INetConnectionPropertyUi, (LPVOID*)&pNCP);
592  if (FAILED(hr))
593  {
594  NcFreeNetconProperties(pProperties);
595  return hr;
596  }
597 
598  hr = pNCP->SetConnection(pNetConnect);
599  if (SUCCEEDED(hr))
600  {
601  ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
602  ZeroMemory(hppages, sizeof(hppages));
603  pinfo.dwSize = sizeof(PROPSHEETHEADERW);
604  pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
608  pinfo.phpage = hppages;
609  pinfo.hwndParent = hwnd;
610  pinfo.pfnCallback = PropSheetProc;
611 
612  pinfo.pszCaption = pProperties->pszwName;
613  hr = pNCP->AddPages(hwnd, PropSheetExCallback, (LPARAM)&pinfo);
614  if (SUCCEEDED(hr))
615  {
616  if (PropertySheetW(&pinfo) < 0)
617  hr = E_FAIL;
618  }
619  }
620  NcFreeNetconProperties(pProperties);
621  return hr;
622 }
HWND hwndParent
Definition: prsht.h:277
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
HRESULT hr
Definition: shlfolder.c:183
HRESULT GetProperties([out] NETCON_PROPERTIES **ppProps)
#define ZeroMemory
Definition: winbase.h:1635
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSH_USECALLBACK
Definition: prsht.h:48
#define E_FAIL
Definition: ddrawi.h:102
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
EXTERN_C const IID IID_INetConnectionPropertyUi
Definition: netcon.h:227
#define PSH_USEICONID
Definition: prsht.h:42
LPCWSTR pszCaption
Definition: prsht.h:283
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:293
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2902
#define IDI_SHELL_NETWORK_FOLDER
Definition: resource.h:5
#define PSH_PROPTITLE
Definition: prsht.h:40
LONG HRESULT
Definition: typedefs.h:77
HINSTANCE hInstance
Definition: prsht.h:278
BOOL CALLBACK PropSheetExCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
LPCWSTR pszIcon
Definition: prsht.h:281
DWORD dwSize
Definition: prsht.h:275
DWORD dwFlags
Definition: prsht.h:276
HPROPSHEETPAGE * phpage
Definition: prsht.h:291
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
HRESULT GetUiObjectClassId([out, ref] CLSID *pclsid)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MAX_PROPERTY_SHEET_PAGE
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CNetConUiObject::InvokeCommand(), LANStatusUiDlg(), and ShowStatusPropertyDialog().

◆ ShowNetConnectionStatus()

HRESULT ShowNetConnectionStatus ( IOleCommandTarget lpOleCmd,
PCUITEMID_CHILD  pidl,
HWND  hwnd 
)

Definition at line 534 of file shfldr_netconnect.cpp.

538 {
539  if (!lpOleCmd)
540  return E_FAIL;
541 
543  if (!pdata)
544  {
545  ERR("Got invalid pidl!\n");
546  return E_FAIL;
547  }
548 
549  return lpOleCmd->Exec(&pdata->guidId, OLECMDID_NEW, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
550 }
#define E_FAIL
Definition: ddrawi.h:102
HRESULT Exec([in, unique] const GUID *pguidCmdGroup, [in] DWORD nCmdID, [in] DWORD nCmdexecopt, [in, unique] VARIANT *pvaIn, [in, out, unique] VARIANT *pvaOut)
smooth NULL
Definition: ftsmooth.c:416
PNETCONIDSTRUCT ILGetConnData(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:10
static PROTOCOLDATA * pdata
Definition: protocol.c:157
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by CNetworkConnections::Execute(), and CNetConUiObject::InvokeCommand().

Variable Documentation

◆ NetConnectSFHeader