ReactOS  0.4.15-dev-2776-g4130f0b
filedlgbrowser.h File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "shlobj.h"
#include "objbase.h"
#include "commdlg.h"
Include dependency graph for filedlgbrowser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FileOpenDlgInfos
 

Macros

#define FODPROP_SAVEDLG   0x0001 /* File dialog is a Save file dialog */
 
#define FODPROP_USEVIEW
 
#define IDS_FILENOTFOUND   114
 
#define IDS_VERIFYFILE   115
 
#define IDS_CREATEFILE   116
 
#define IDS_OVERWRITEFILE   119
 
#define IDS_INVALID_FILENAME_TITLE   120
 
#define IDS_INVALID_FILENAME   121
 
#define IDS_PATHNOTEXISTING   122
 
#define IDS_FILENOTEXISTING   123
 
#define IDS_INVALID_FOLDERNAME   124
 
#define IDS_UPFOLDER   150
 
#define IDS_NEWFOLDER   151
 
#define IDS_LISTVIEW   152
 
#define IDS_REPORTVIEW   153
 
#define IDS_TODESKTOP   154
 
#define IDC_OPENREADONLY   chx1
 
#define IDC_TOOLBARSTATIC   stc1
 
#define IDC_FILETYPESTATIC   stc2
 
#define IDC_FILENAMESTATIC   stc3
 
#define IDC_LOOKINSTATIC   stc4
 
#define IDC_SHELLSTATIC   lst1
 
#define IDC_FILETYPE   cmb1
 
#define IDC_LOOKIN   cmb2
 
#define IDC_FILENAME   edt1
 
#define IDC_TOOLBAR   1
 
#define IDC_TOOLBARPLACES   ctl1
 

Functions

IShellBrowserIShellBrowserImpl_Construct (HWND hwndOwner) DECLSPEC_HIDDEN
 
LPITEMIDLIST GetPidlFromDataObject (IDataObject *doSelected, UINT nPidlIndex) DECLSPEC_HIDDEN
 
void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd) DECLSPEC_HIDDEN
 
FileOpenDlgInfosget_filedlg_infoptr (HWND hwnd) DECLSPEC_HIDDEN
 
IShellFolderGetShellFolderFromPidl (LPITEMIDLIST pidlAbs) DECLSPEC_HIDDEN
 
LPITEMIDLIST GetParentPidl (LPITEMIDLIST pidl) DECLSPEC_HIDDEN
 
int FILEDLG95_LOOKIN_SelectItem (HWND hwnd, LPITEMIDLIST pidl) DECLSPEC_HIDDEN
 
LRESULT SendCustomDlgNotificationMessage (HWND hwndParentDlg, UINT uCode) DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ FODPROP_SAVEDLG

#define FODPROP_SAVEDLG   0x0001 /* File dialog is a Save file dialog */

Definition at line 42 of file filedlgbrowser.h.

◆ FODPROP_USEVIEW

#define FODPROP_USEVIEW
Value:
0x0002 /* Indicates the user selection must be taken
from the IShellView */

Definition at line 43 of file filedlgbrowser.h.

◆ IDC_FILENAME

#define IDC_FILENAME   edt1

Definition at line 137 of file filedlgbrowser.h.

◆ IDC_FILENAMESTATIC

#define IDC_FILENAMESTATIC   stc3

Definition at line 129 of file filedlgbrowser.h.

◆ IDC_FILETYPE

#define IDC_FILETYPE   cmb1

Definition at line 134 of file filedlgbrowser.h.

◆ IDC_FILETYPESTATIC

#define IDC_FILETYPESTATIC   stc2

Definition at line 128 of file filedlgbrowser.h.

◆ IDC_LOOKIN

#define IDC_LOOKIN   cmb2

Definition at line 135 of file filedlgbrowser.h.

◆ IDC_LOOKINSTATIC

#define IDC_LOOKINSTATIC   stc4

Definition at line 130 of file filedlgbrowser.h.

◆ IDC_OPENREADONLY

#define IDC_OPENREADONLY   chx1

Definition at line 125 of file filedlgbrowser.h.

◆ IDC_SHELLSTATIC

#define IDC_SHELLSTATIC   lst1

Definition at line 132 of file filedlgbrowser.h.

◆ IDC_TOOLBAR

#define IDC_TOOLBAR   1

Definition at line 139 of file filedlgbrowser.h.

◆ IDC_TOOLBARPLACES

#define IDC_TOOLBARPLACES   ctl1

Definition at line 140 of file filedlgbrowser.h.

◆ IDC_TOOLBARSTATIC

#define IDC_TOOLBARSTATIC   stc1

Definition at line 127 of file filedlgbrowser.h.

◆ IDS_CREATEFILE

#define IDS_CREATEFILE   116

Definition at line 109 of file filedlgbrowser.h.

◆ IDS_FILENOTEXISTING

#define IDS_FILENOTEXISTING   123

Definition at line 114 of file filedlgbrowser.h.

◆ IDS_FILENOTFOUND

#define IDS_FILENOTFOUND   114

Definition at line 107 of file filedlgbrowser.h.

◆ IDS_INVALID_FILENAME

#define IDS_INVALID_FILENAME   121

Definition at line 112 of file filedlgbrowser.h.

◆ IDS_INVALID_FILENAME_TITLE

#define IDS_INVALID_FILENAME_TITLE   120

Definition at line 111 of file filedlgbrowser.h.

◆ IDS_INVALID_FOLDERNAME

#define IDS_INVALID_FOLDERNAME   124

Definition at line 115 of file filedlgbrowser.h.

◆ IDS_LISTVIEW

#define IDS_LISTVIEW   152

Definition at line 121 of file filedlgbrowser.h.

◆ IDS_NEWFOLDER

#define IDS_NEWFOLDER   151

Definition at line 120 of file filedlgbrowser.h.

◆ IDS_OVERWRITEFILE

#define IDS_OVERWRITEFILE   119

Definition at line 110 of file filedlgbrowser.h.

◆ IDS_PATHNOTEXISTING

#define IDS_PATHNOTEXISTING   122

Definition at line 113 of file filedlgbrowser.h.

◆ IDS_REPORTVIEW

#define IDS_REPORTVIEW   153

Definition at line 122 of file filedlgbrowser.h.

◆ IDS_TODESKTOP

#define IDS_TODESKTOP   154

Definition at line 123 of file filedlgbrowser.h.

◆ IDS_UPFOLDER

#define IDS_UPFOLDER   150

Definition at line 119 of file filedlgbrowser.h.

◆ IDS_VERIFYFILE

#define IDS_VERIFYFILE   115

Definition at line 108 of file filedlgbrowser.h.

Function Documentation

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 4244 of file filedlg.c.

4245 {
4247  LPITEMIDLIST pidl;
4248  LPWSTR lpstrAllFiles, lpstrTmp;
4249  UINT nFiles = 0, nFileToOpen, nFileSelected, nAllFilesLength = 0, nThisFileLength, nAllFilesMaxLength;
4250  STGMEDIUM medium;
4251  LPIDA cida;
4252  FORMATETC formatetc = get_def_format();
4253 
4254  TRACE("\n");
4255 
4256  if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium)))
4257  return;
4258 
4259  cida = GlobalLock(medium.u.hGlobal);
4260  nFileSelected = cida->cidl;
4261 
4262  /* Allocate a buffer */
4263  nAllFilesMaxLength = MAX_PATH + 3;
4264  lpstrAllFiles = heap_alloc_zero(nAllFilesMaxLength * sizeof(WCHAR));
4265  if (!lpstrAllFiles)
4266  goto ret;
4267 
4268  /* Loop through the selection, handle only files (not folders) */
4269  for (nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++)
4270  {
4271  pidl = (LPITEMIDLIST)((LPBYTE)cida + cida->aoffset[nFileToOpen + 1]);
4272  if (pidl)
4273  {
4274  if (!IsPidlFolder(fodInfos->Shell.FOIShellFolder, pidl))
4275  {
4276  if (nAllFilesLength + MAX_PATH + 3 > nAllFilesMaxLength)
4277  {
4278  nAllFilesMaxLength *= 2;
4279  lpstrTmp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpstrAllFiles, nAllFilesMaxLength * sizeof(WCHAR));
4280  if (!lpstrTmp)
4281  goto ret;
4282  lpstrAllFiles = lpstrTmp;
4283  }
4284  nFiles += 1;
4285  lpstrAllFiles[nAllFilesLength++] = '"';
4286  GetName(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, lpstrAllFiles + nAllFilesLength);
4287  nThisFileLength = lstrlenW(lpstrAllFiles + nAllFilesLength);
4288  nAllFilesLength += nThisFileLength;
4289  lpstrAllFiles[nAllFilesLength++] = '"';
4290  lpstrAllFiles[nAllFilesLength++] = ' ';
4291  }
4292  }
4293  }
4294 
4295  if (nFiles != 0)
4296  {
4297  /* If there's only one file, use the name as-is without quotes */
4298  lpstrTmp = lpstrAllFiles;
4299  if (nFiles == 1)
4300  {
4301  lpstrTmp += 1;
4302  lpstrTmp[nThisFileLength] = 0;
4303  }
4304  SetWindowTextW(fodInfos->DlgInfos.hwndFileName, lpstrTmp);
4305  /* Select the file name like Windows does */
4306  if (filename_is_edit(fodInfos))
4307  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
4308  }
4309 
4310 ret:
4311  heap_free(lpstrAllFiles);
4312  COMCTL32_ReleaseStgMedium(medium);
4313 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD dwFlags, LPWSTR lpstrFileName)
Definition: filedlg.c:4468
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
struct FileOpenDlgInfos::@330 DlgInfos
static void COMCTL32_ReleaseStgMedium(STGMEDIUM medium)
Definition: filedlg.c:4382
#define lstrlenW
Definition: compat.h:609
static FORMATETC get_def_format(void)
Definition: filedlg.c:4225
unsigned char * LPBYTE
Definition: typedefs.h:53
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define EM_SETSEL
Definition: winuser.h:2000
UINT cidl
Definition: shlobj.h:499
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
struct FileOpenDlgInfos::@328 Shell
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HeapReAlloc
Definition: compat.h:593
UINT aoffset[1]
Definition: shlobj.h:500
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4569
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1618
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:229
Definition: shlobj.h:498
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by IShellBrowserImpl_OnSelChange().

◆ FILEDLG95_LOOKIN_SelectItem()

int FILEDLG95_LOOKIN_SelectItem ( HWND  hwnd,
LPITEMIDLIST  pidl 
)

Definition at line 4090 of file filedlg.c.

4091 {
4092  int iItemPos;
4093  LookInInfos *liInfos;
4094 
4095  TRACE("%p, %p\n", hwnd, pidl);
4096 
4098 
4099  liInfos = GetPropA(hwnd,LookInInfosStr);
4100 
4101  if(iItemPos < 0)
4102  {
4105  }
4106 
4107  else
4108  {
4109  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
4110  while(liInfos->iMaxIndentation > tmpFolder->m_iIndent)
4111  {
4112  int iRemovedItem;
4113 
4114  if(-1 == (iRemovedItem = FILEDLG95_LOOKIN_RemoveMostExpandedItem(hwnd)))
4115  break;
4116  if(iRemovedItem < iItemPos)
4117  iItemPos--;
4118  }
4119  }
4120 
4121  SendMessageW(hwnd, CB_SETCURSEL, iItemPos, 0);
4122  liInfos->uSelectedItem = iItemPos;
4123 
4124  return 0;
4125 
4126 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const char LookInInfosStr[]
Definition: filedlg.c:217
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:4163
UINT_PTR WPARAM
Definition: windef.h:207
int iMaxIndentation
Definition: filedlg.c:107
#define SEARCH_PIDL
Definition: filedlg.c:195
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:214
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:100
#define CB_SETCURSEL
Definition: winuser.h:1943
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static int FILEDLG95_LOOKIN_RemoveMostExpandedItem(HWND hwnd)
Definition: filedlg.c:4133
UINT uSelectedItem
Definition: filedlg.c:108
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:4061
struct SFolder * LPSFOLDER

Referenced by IShellBrowserImpl_BrowseObject().

◆ get_filedlg_infoptr()

◆ GetParentPidl()

LPITEMIDLIST GetParentPidl ( LPITEMIDLIST  pidl)

Definition at line 4525 of file filedlg.c.

4526 {
4527  LPITEMIDLIST pidlParent;
4528 
4529  TRACE("%p\n", pidl);
4530 
4531  pidlParent = ILClone(pidl);
4532  ILRemoveLastID(pidlParent);
4533 
4534  return pidlParent;
4535 }
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:212
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by FILEDLG95_LOOKIN_InsertItemAfterParent(), and IShellBrowserImpl_BrowseObject().

◆ GetPidlFromDataObject()

LPITEMIDLIST GetPidlFromDataObject ( IDataObject doSelected,
UINT  nPidlIndex 
)

Definition at line 4402 of file filedlg.c.

4403 {
4404 
4405  STGMEDIUM medium;
4406  FORMATETC formatetc = get_def_format();
4407  LPITEMIDLIST pidl = NULL;
4408 
4409  TRACE("sv=%p index=%u\n", doSelected, nPidlIndex);
4410 
4411  if (!doSelected)
4412  return NULL;
4413 
4414  /* Get the pidls from IDataObject */
4415  if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
4416  {
4417  LPIDA cida = GlobalLock(medium.u.hGlobal);
4418  if(nPidlIndex <= cida->cidl)
4419  {
4420  pidl = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[nPidlIndex]]));
4421  }
4422  COMCTL32_ReleaseStgMedium(medium);
4423  }
4424  return pidl;
4425 }
static void COMCTL32_ReleaseStgMedium(STGMEDIUM medium)
Definition: filedlg.c:4382
static FORMATETC get_def_format(void)
Definition: filedlg.c:4225
unsigned char * LPBYTE
Definition: typedefs.h:53
if SUCCEEDED(hr)
#define TRACE(s)
Definition: solgame.cpp:4
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define NULL
Definition: types.h:112
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
Definition: shlobj.h:498

Referenced by BrowseSelectedFolder(), and IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand().

◆ GetShellFolderFromPidl()

IShellFolder* GetShellFolderFromPidl ( LPITEMIDLIST  pidlAbs)

Definition at line 4497 of file filedlg.c.

4498 {
4499  IShellFolder *psf = NULL,*psfParent;
4500 
4501  TRACE("%p\n", pidlAbs);
4502 
4503  if(SUCCEEDED(SHGetDesktopFolder(&psfParent)))
4504  {
4505  psf = psfParent;
4506  if(pidlAbs && pidlAbs->mkid.cb)
4507  {
4508  if(SUCCEEDED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf)))
4509  {
4510  IShellFolder_Release(psfParent);
4511  return psf;
4512  }
4513  }
4514  /* return the desktop */
4515  return psfParent;
4516  }
4517  return NULL;
4518 }
if SUCCEEDED(hr)
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define NULL
Definition: types.h:112

Referenced by IShellBrowserImpl_BrowseObject().

◆ IShellBrowserImpl_Construct()

IShellBrowser* IShellBrowserImpl_Construct ( HWND  hwndOwner)

Definition at line 199 of file filedlgbrowser.c.

200 {
201  FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndOwner);
203 
204  sb = heap_alloc(sizeof(*sb));
205 
206  /* Initialisation of the member variables */
207  sb->ref=1;
208  sb->hwndOwner = hwndOwner;
209 
210  /* Initialisation of the vTables */
211  sb->IShellBrowser_iface.lpVtbl = &IShellBrowserImpl_Vtbl;
212  sb->ICommDlgBrowser_iface.lpVtbl = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
213  sb->IServiceProvider_iface.lpVtbl = &IShellBrowserImpl_IServiceProvider_Vtbl;
215  &fodInfos->ShellInfos.pidlAbsCurrent);
216 
217  TRACE("%p\n", sb);
218 
219  return &sb->IShellBrowser_iface;
220 }
superblock * sb
Definition: btrfs.c:4220
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
struct FileOpenDlgInfos::@329 ShellInfos
static const IShellBrowserVtbl IShellBrowserImpl_Vtbl
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
Implementation of IShellBrowser and ICommDlgBrowser interfaces for explorer child windows (see ShellB...
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2830
static const IServiceProviderVtbl IShellBrowserImpl_IServiceProvider_Vtbl
static const ICommDlgBrowserVtbl IShellBrowserImpl_ICommDlgBrowser_Vtbl
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:229

Referenced by FILEDLG95_SHELL_Init().

◆ SendCustomDlgNotificationMessage()

LRESULT SendCustomDlgNotificationMessage ( HWND  hwndParentDlg,
UINT  uCode 
)

Definition at line 1070 of file filedlg.c.

1071 {
1072  FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndParentDlg);
1073  LRESULT hook_result;
1074  OFNOTIFYW ofnNotify;
1075 
1076  TRACE("%p %d\n", hwndParentDlg, uCode);
1077 
1078  if (!fodInfos || !fodInfos->DlgInfos.hwndCustomDlg)
1079  return 0;
1080 
1081  TRACE("CALL NOTIFY for %d\n", uCode);
1082 
1083  ofnNotify.hdr.hwndFrom = hwndParentDlg;
1084  ofnNotify.hdr.idFrom = 0;
1085  ofnNotify.hdr.code = uCode;
1086  ofnNotify.lpOFN = fodInfos->ofnInfos;
1087  ofnNotify.pszFile = NULL;
1088 
1089  if (fodInfos->unicode)
1090  hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify);
1091  else
1092  hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify);
1093 
1094  TRACE("RET NOTIFY retval %#lx\n", hook_result);
1095 
1096  return hook_result;
1097 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct FileOpenDlgInfos::@330 DlgInfos
UINT code
Definition: winuser.h:3134
UINT_PTR idFrom
Definition: winuser.h:3133
LONG_PTR LPARAM
Definition: windef.h:208
LPOPENFILENAMEW ofnInfos
#define TRACE(s)
Definition: solgame.cpp:4
NMHDR hdr
Definition: commdlg.h:411
LPOPENFILENAMEW lpOFN
Definition: commdlg.h:412
HWND hwndFrom
Definition: winuser.h:3132
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
LPWSTR pszFile
Definition: commdlg.h:413
LONG_PTR LRESULT
Definition: windef.h:209
#define WM_NOTIFY
Definition: richedit.h:61
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:229

Referenced by BrowseSelectedFolder(), FILEDLG95_FILETYPE_OnCommand(), FILEDLG95_LOOKIN_OnCommand(), FILEDLG95_OnOpen(), FILEDLG95_SendFileOK(), FILEDLG95_SHELL_UpFolder(), filedlg_browse_to_pidl(), FileOpenDlgProc95(), IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(), and IShellBrowserImpl_OnSelChange().