ReactOS 0.4.15-dev-6055-g36cdd34
CCopyToMenu.cpp File Reference
#include "precomp.h"
Include dependency graph for CCopyToMenu.cpp:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static int CALLBACK BrowseCallbackProc (HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
 

Function Documentation

◆ BrowseCallbackProc()

static int CALLBACK BrowseCallbackProc ( HWND  hwnd,
UINT  uMsg,
LPARAM  lParam,
LPARAM  lpData 
)
static

Definition at line 69 of file CCopyToMenu.cpp.

70{
71 CCopyToMenu *this_ =
72 reinterpret_cast<CCopyToMenu *>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
73
74 switch (uMsg)
75 {
77 {
79 this_ = reinterpret_cast<CCopyToMenu *>(lpData);
80
81 // Select initial directory
83 reinterpret_cast<LPARAM>(static_cast<LPCITEMIDLIST>(this_->m_pidlFolder)));
84
85 // Set caption
87 SetWindowTextW(hwnd, strCaption);
88
89 // Set OK button text
91 SetDlgItemText(hwnd, IDOK, strCopy);
92
93 // Subclassing
94 this_->m_fnOldWndProc =
95 reinterpret_cast<WNDPROC>(
97
98 // Disable OK
100 break;
101 }
102 case BFFM_SELCHANGED:
103 {
104 if (!this_)
105 break;
106
108 LPCITEMIDLIST pidl = reinterpret_cast<LPCITEMIDLIST>(lParam);
109
110 szPath[0] = 0;
112
113 if (ILIsEqual(pidl, this_->m_pidlFolder))
115 else if (PathFileExistsW(szPath) || _ILIsDesktop(pidl))
117 else
119
120 // the text box will be updated later soon, ignore it
122 break;
123 }
124 }
125
126 return FALSE;
127}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CCopyToMenu.cpp:27
BOOL m_bIgnoreTextBoxChange
CComHeapPtr< ITEMIDLIST > m_pidlFolder
WNDPROC m_fnOldWndProc
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1777
LPCWSTR szPath
Definition: env.c:37
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1298
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:539
#define BFFM_SELCHANGED
Definition: shlobj.h:1164
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
#define BFFM_SETSELECTION
Definition: shlobj.h:1183
#define BFFM_INITIALIZED
Definition: shlobj.h:1163
#define IDS_COPYBUTTON
Definition: shresdef.h:325
#define IDS_COPYITEMS
Definition: shresdef.h:324
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDOK
Definition: winuser.h:824
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
#define SetDlgItemText
Definition: winuser.h:5839
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ WindowProc()

static LRESULT CALLBACK WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 27 of file CCopyToMenu.cpp.

28{
30 CCopyToMenu *this_ =
31 reinterpret_cast<CCopyToMenu *>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
32
33 switch (uMsg)
34 {
35 case WM_COMMAND:
36 {
37 switch (LOWORD(wParam))
38 {
40 {
41 if (HIWORD(wParam) == EN_CHANGE)
42 {
43 if (!this_->m_bIgnoreTextBoxChange)
44 {
45 // get the text
47 StrTrimW(szPath, L" \t");
48
49 // update OK button
51 SendMessageW(hwnd, BFFM_ENABLEOK, 0, bValid);
52
53 return 0;
54 }
55
56 // reset flag
58 }
59 break;
60 }
61 }
62 break;
63 }
64 }
65 return CallWindowProcW(this_->m_fnOldWndProc, hwnd, uMsg, wParam, lParam);
66}
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1723
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
unsigned int BOOL
Definition: ntddk_ex.h:94
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define PathIsRelative
Definition: shlwapi.h:951
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:415
#define _countof(array)
Definition: sndvol32.h:68
#define HIWORD(l)
Definition: typedefs.h:247
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define WM_COMMAND
Definition: winuser.h:1730
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define EN_CHANGE
Definition: winuser.h:2012

Referenced by BrowseCallbackProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )