ReactOS 0.4.16-dev-197-g92996da
shfldr_netconnect.cpp File Reference
#include "precomp.h"
#include <shellfolderutils.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 31 of file shfldr_netconnect.cpp.

◆ COLUMN_NAME

#define COLUMN_NAME   0

Definition at line 28 of file shfldr_netconnect.cpp.

◆ COLUMN_OWNER

#define COLUMN_OWNER   5

Definition at line 33 of file shfldr_netconnect.cpp.

◆ COLUMN_PHONE

#define COLUMN_PHONE   4

Definition at line 32 of file shfldr_netconnect.cpp.

◆ COLUMN_STATUS

#define COLUMN_STATUS   2

Definition at line 30 of file shfldr_netconnect.cpp.

◆ COLUMN_TYPE

#define COLUMN_TYPE   1

Definition at line 29 of file shfldr_netconnect.cpp.

◆ MAX_PROPERTY_SHEET_PAGE

#define MAX_PROPERTY_SHEET_PAGE   (10)

Definition at line 11 of file shfldr_netconnect.cpp.

◆ NETCONNECTSHELLVIEWCOLUMNS

#define NETCONNECTSHELLVIEWCOLUMNS   6

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

429{
430 MENUITEMINFOW mii;
431 WCHAR szText[100];
432
433 ZeroMemory(&mii, sizeof(mii));
434 mii.cbSize = sizeof(mii);
435 if (fType == MFT_SEPARATOR)
436 {
437 mii.fMask = MIIM_ID | MIIM_TYPE;
438 }
439 else if (fType == MFT_STRING)
440 {
442 if ((ULONG_PTR)HIWORD((ULONG_PTR)dwTypeData) == 0)
443 {
444 if (LoadStringW(netshell_hInstance, LOWORD((ULONG_PTR)dwTypeData), szText, sizeof(szText)/sizeof(WCHAR)))
445 {
446 szText[(sizeof(szText)/sizeof(WCHAR))-1] = 0;
447 mii.dwTypeData = szText;
448 }
449 else
450 {
451 return;
452 }
453 }
454 else
455 {
456 mii.dwTypeData = (LPWSTR) dwTypeData;
457 }
458 mii.fState = fState;
459 }
460
461 mii.wID = wID;
462 mii.fType = fType;
463 InsertMenuItemW( hmenu, indexMenu, fByPosition, &mii);
464}
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
#define LOWORD(l)
Definition: pedump.c:82
LPWSTR dwTypeData
Definition: winuser.h:3272
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:1736
#define MIIM_ID
Definition: winuser.h:725
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:747
#define MIIM_STATE
Definition: winuser.h:724
#define MFT_STRING
Definition: winuser.h:749
#define MIIM_TYPE
Definition: winuser.h:728
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 BrFolder_OnContextMenu(), 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 524 of file shfldr_netconnect.cpp.

525{
527
528 if (pinfo->nPages < MAX_PROPERTY_SHEET_PAGE)
529 {
530 pinfo->phpage[pinfo->nPages++] = hPage;
531 return TRUE;
532 }
533 return FALSE;
534}
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 556 of file shfldr_netconnect.cpp.

557{
558 // NOTE: This callback is needed to set large icon correctly.
559 HICON hIcon;
560 switch (uMsg)
561 {
562 case PSCB_INITIALIZED:
563 {
565 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
566 break;
567 }
568 }
569 return 0;
570}
#define IDI_SHELL_NETWORK_FOLDER
Definition: resource.h:5
static HICON
Definition: imagelist.c:80
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:2127
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ShowNetConnectionProperties().

◆ ShowNetConnectionProperties()

HRESULT ShowNetConnectionProperties ( INetConnection pNetConnect,
HWND  hwnd 
)

Definition at line 573 of file shfldr_netconnect.cpp.

576{
577 HRESULT hr;
578 CLSID ClassID;
579 PROPSHEETHEADERW pinfo;
582 NETCON_PROPERTIES * pProperties;
583
584 if (pNetConnect->GetProperties(&pProperties) != S_OK)
585 return E_FAIL;
586
587 hr = pNetConnect->GetUiObjectClassId(&ClassID);
588 if (FAILED(hr))
589 {
590 NcFreeNetconProperties(pProperties);
591 return hr;
592 }
593
594 hr = CoCreateInstance(ClassID, NULL, CLSCTX_INPROC_SERVER, IID_INetConnectionPropertyUi, (LPVOID*)&pNCP);
595 if (FAILED(hr))
596 {
597 NcFreeNetconProperties(pProperties);
598 return hr;
599 }
600
601 hr = pNCP->SetConnection(pNetConnect);
602 if (SUCCEEDED(hr))
603 {
604 ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
605 ZeroMemory(hppages, sizeof(hppages));
606 pinfo.dwSize = sizeof(PROPSHEETHEADERW);
607 pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
611 pinfo.phpage = hppages;
612 pinfo.hwndParent = hwnd;
614
615 pinfo.pszCaption = pProperties->pszwName;
616 hr = pNCP->AddPages(hwnd, PropSheetExCallback, (LPARAM)&pinfo);
617 if (SUCCEEDED(hr))
618 {
619 if (PropertySheetW(&pinfo) < 0)
620 hr = E_FAIL;
621 }
622 }
623 NcFreeNetconProperties(pProperties);
624 return hr;
625}
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
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 537 of file shfldr_netconnect.cpp.

541{
542 if (!lpOleCmd)
543 return E_FAIL;
544
546 if (!pdata)
547 {
548 ERR("Got invalid pidl\n");
549 return E_FAIL;
550 }
551
552 return lpOleCmd->Exec(&pdata->guidId, OLECMDID_NEW, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
553}
#define ERR(fmt,...)
Definition: precomp.h:57
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