ReactOS  0.4.15-dev-3440-g915569a
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  {
76  case BFFM_INITIALIZED:
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>(
96  SetWindowLongPtr(hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(WindowProc)));
97 
98  // Disable OK
100  break;
101  }
102  case BFFM_SELCHANGED:
103  {
105  LPCITEMIDLIST pidl = reinterpret_cast<LPCITEMIDLIST>(lParam);
106 
107  szPath[0] = 0;
109 
110  if (ILIsEqual(pidl, this_->m_pidlFolder))
112  else if (PathFileExistsW(szPath) || _ILIsDesktop(pidl))
114  else
116 
117  // the text box will be updated later soon, ignore it
118  this_->m_bIgnoreTextBoxChange = TRUE;
119  break;
120  }
121  }
122 
123  return FALSE;
124 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
CComHeapPtr< ITEMIDLIST > m_pidlFolder
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CCopyToMenu.cpp:27
#define BFFM_INITIALIZED
Definition: shlobj.h:1163
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:535
#define IDS_COPYBUTTON
Definition: shresdef.h:315
#define SetWindowLongPtr
Definition: treelist.c:70
#define FALSE
Definition: types.h:117
#define BFFM_SETSELECTION
Definition: shlobj.h:1183
#define GWLP_USERDATA
Definition: treelist.c:63
WNDPROC m_fnOldWndProc
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1776
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define SetDlgItemText
Definition: winuser.h:5829
BOOL m_bIgnoreTextBoxChange
#define GWLP_WNDPROC
Definition: treelist.c:66
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
LPCWSTR szPath
Definition: env.c:37
#define BFFM_SELCHANGED
Definition: shlobj.h:1164
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_COPYITEMS
Definition: shresdef.h:314
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define GetWindowLongPtr
Definition: treelist.c:73
LPARAM lParam
Definition: combotst.c:139

Referenced by CCopyToMenu::DoCopyToFolder().

◆ 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 }
#define IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT
Definition: shresdef.h:405
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1722
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define PathIsRelative
Definition: shlwapi.h:951
WPARAM wParam
Definition: combotst.c:138
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GWLP_USERDATA
Definition: treelist.c:63
WNDPROC m_fnOldWndProc
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define WM_COMMAND
Definition: winuser.h:1727
BOOL m_bIgnoreTextBoxChange
#define BFFM_ENABLEOK
Definition: shlobj.h:1171
LPCWSTR szPath
Definition: env.c:37
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define EN_CHANGE
Definition: winuser.h:2009

Referenced by BrowseCallbackProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )