ReactOS 0.4.15-dev-7887-g64a59a1
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 30 of file shfldr_netconnect.cpp.

◆ COLUMN_NAME

#define COLUMN_NAME   0

Definition at line 27 of file shfldr_netconnect.cpp.

◆ COLUMN_OWNER

#define COLUMN_OWNER   5

Definition at line 32 of file shfldr_netconnect.cpp.

◆ COLUMN_PHONE

#define COLUMN_PHONE   4

Definition at line 31 of file shfldr_netconnect.cpp.

◆ COLUMN_STATUS

#define COLUMN_STATUS   2

Definition at line 29 of file shfldr_netconnect.cpp.

◆ COLUMN_TYPE

#define COLUMN_TYPE   1

Definition at line 28 of file shfldr_netconnect.cpp.

◆ MAX_PROPERTY_SHEET_PAGE

#define MAX_PROPERTY_SHEET_PAGE   (10)

Definition at line 10 of file shfldr_netconnect.cpp.

◆ NETCONNECTSHELLVIEWCOLUMNS

#define NETCONNECTSHELLVIEWCOLUMNS   6

Definition at line 25 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 398 of file shfldr_netconnect.cpp.

406{
407 MENUITEMINFOW mii;
408 WCHAR szText[100];
409
410 ZeroMemory(&mii, sizeof(mii));
411 mii.cbSize = sizeof(mii);
412 if (fType == MFT_SEPARATOR)
413 {
414 mii.fMask = MIIM_ID | MIIM_TYPE;
415 }
416 else if (fType == MFT_STRING)
417 {
419 if ((ULONG_PTR)HIWORD((ULONG_PTR)dwTypeData) == 0)
420 {
421 if (LoadStringW(netshell_hInstance, LOWORD((ULONG_PTR)dwTypeData), szText, sizeof(szText)/sizeof(WCHAR)))
422 {
423 szText[(sizeof(szText)/sizeof(WCHAR))-1] = 0;
424 mii.dwTypeData = szText;
425 }
426 else
427 {
428 return;
429 }
430 }
431 else
432 {
433 mii.dwTypeData = (LPWSTR) dwTypeData;
434 }
435 mii.fState = fState;
436 }
437
438 mii.wID = wID;
439 mii.fType = fType;
440 InsertMenuItemW( hmenu, indexMenu, fByPosition, &mii);
441}
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
#define LOWORD(l)
Definition: pedump.c:82
LPWSTR dwTypeData
Definition: winuser.h:3269
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define HIWORD(l)
Definition: typedefs.h:247
static HMENU hmenu
Definition: win.c:66
#define ZeroMemory
Definition: winbase.h:1712
#define MIIM_ID
Definition: winuser.h:722
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MFT_SEPARATOR
Definition: winuser.h:744
#define MIIM_STATE
Definition: winuser.h:721
#define MFT_STRING
Definition: winuser.h:746
#define MIIM_TYPE
Definition: winuser.h:725
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

◆ PropSheetExCallback()

BOOL CALLBACK PropSheetExCallback ( HPROPSHEETPAGE  hPage,
LPARAM  lParam 
)

Definition at line 501 of file shfldr_netconnect.cpp.

502{
504
505 if (pinfo->nPages < MAX_PROPERTY_SHEET_PAGE)
506 {
507 pinfo->phpage[pinfo->nPages++] = hPage;
508 return TRUE;
509 }
510 return FALSE;
511}
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PROPERTY_SHEET_PAGE
HPROPSHEETPAGE * phpage
Definition: prsht.h:309

Referenced by ShowNetConnectionProperties().

◆ PropSheetProc()

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

Definition at line 533 of file shfldr_netconnect.cpp.

534{
535 // NOTE: This callback is needed to set large icon correctly.
536 HICON hIcon;
537 switch (uMsg)
538 {
539 case PSCB_INITIALIZED:
540 {
542 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
543 break;
544 }
545 }
546 return 0;
547}
#define IDI_SHELL_NETWORK_FOLDER
Definition: resource.h:5
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define ICON_BIG
Definition: tnclass.cpp:51
LONG_PTR LPARAM
Definition: windef.h:208
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2075
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ShowNetConnectionProperties().

◆ ShowNetConnectionProperties()

HRESULT ShowNetConnectionProperties ( INetConnection pNetConnect,
HWND  hwnd 
)

Definition at line 550 of file shfldr_netconnect.cpp.

553{
554 HRESULT hr;
555 CLSID ClassID;
556 PROPSHEETHEADERW pinfo;
559 NETCON_PROPERTIES * pProperties;
560
561 if (pNetConnect->GetProperties(&pProperties) != S_OK)
562 return E_FAIL;
563
564 hr = pNetConnect->GetUiObjectClassId(&ClassID);
565 if (FAILED(hr))
566 {
567 NcFreeNetconProperties(pProperties);
568 return hr;
569 }
570
571 hr = CoCreateInstance(ClassID, NULL, CLSCTX_INPROC_SERVER, IID_INetConnectionPropertyUi, (LPVOID*)&pNCP);
572 if (FAILED(hr))
573 {
574 NcFreeNetconProperties(pProperties);
575 return hr;
576 }
577
578 hr = pNCP->SetConnection(pNetConnect);
579 if (SUCCEEDED(hr))
580 {
581 ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
582 ZeroMemory(hppages, sizeof(hppages));
583 pinfo.dwSize = sizeof(PROPSHEETHEADERW);
584 pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
588 pinfo.phpage = hppages;
589 pinfo.hwndParent = hwnd;
591
592 pinfo.pszCaption = pProperties->pszwName;
593 hr = pNCP->AddPages(hwnd, PropSheetExCallback, (LPARAM)&pinfo);
594 if (SUCCEEDED(hr))
595 {
596 if (PropertySheetW(&pinfo) < 0)
597 hr = E_FAIL;
598 }
599 }
600 NcFreeNetconProperties(pProperties);
601 return hr;
602}
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2913
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT GetProperties([out] NETCON_PROPERTIES **ppProps)
HRESULT GetUiObjectClassId([out, ref] CLSID *pclsid)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
EXTERN_C const IID IID_INetConnectionPropertyUi
Definition: netcon.h:227
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSH_USEICONID
Definition: prsht.h:42
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
BOOL CALLBACK PropSheetExCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
HRESULT hr
Definition: shlfolder.c:183
HINSTANCE hInstance
Definition: prsht.h:296
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
LPCWSTR pszIcon
Definition: prsht.h:299
HWND hwndParent
Definition: prsht.h:295
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
LPCWSTR pszCaption
Definition: prsht.h:301
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

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

◆ ShowNetConnectionStatus()

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

Definition at line 514 of file shfldr_netconnect.cpp.

518{
519 if (!lpOleCmd)
520 return E_FAIL;
521
523 if (!pdata)
524 {
525 ERR("Got invalid pidl\n");
526 return E_FAIL;
527 }
528
529 return lpOleCmd->Exec(&pdata->guidId, OLECMDID_NEW, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
530}
#define ERR(fmt,...)
Definition: debug.h:110
PNETCONIDSTRUCT ILGetConnData(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:10
HRESULT Exec([in, unique] const GUID *pguidCmdGroup, [in] DWORD nCmdID, [in] DWORD nCmdexecopt, [in, unique] VARIANT *pvaIn, [in, out, unique] VARIANT *pvaOut)
static PROTOCOLDATA * pdata
Definition: protocol.c:158

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

Variable Documentation

◆ NetConnectSFHeader