ReactOS  0.4.13-dev-52-g0efcfec
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 132 of file filedlgbrowser.h.

◆ IDC_FILENAMESTATIC

#define IDC_FILENAMESTATIC   stc3

Definition at line 124 of file filedlgbrowser.h.

◆ IDC_FILETYPE

#define IDC_FILETYPE   cmb1

Definition at line 129 of file filedlgbrowser.h.

◆ IDC_FILETYPESTATIC

#define IDC_FILETYPESTATIC   stc2

Definition at line 123 of file filedlgbrowser.h.

◆ IDC_LOOKIN

#define IDC_LOOKIN   cmb2

Definition at line 130 of file filedlgbrowser.h.

◆ IDC_LOOKINSTATIC

#define IDC_LOOKINSTATIC   stc4

Definition at line 125 of file filedlgbrowser.h.

◆ IDC_OPENREADONLY

#define IDC_OPENREADONLY   chx1

Definition at line 120 of file filedlgbrowser.h.

◆ IDC_SHELLSTATIC

#define IDC_SHELLSTATIC   lst1

Definition at line 127 of file filedlgbrowser.h.

◆ IDC_TOOLBAR

#define IDC_TOOLBAR   1

Definition at line 134 of file filedlgbrowser.h.

◆ IDC_TOOLBARPLACES

#define IDC_TOOLBARPLACES   ctl1

Definition at line 135 of file filedlgbrowser.h.

◆ IDC_TOOLBARSTATIC

#define IDC_TOOLBARSTATIC   stc1

Definition at line 122 of file filedlgbrowser.h.

◆ IDS_CREATEFILE

#define IDS_CREATEFILE   116

Definition at line 104 of file filedlgbrowser.h.

◆ IDS_FILENOTEXISTING

#define IDS_FILENOTEXISTING   123

Definition at line 109 of file filedlgbrowser.h.

◆ IDS_FILENOTFOUND

#define IDS_FILENOTFOUND   114

Definition at line 102 of file filedlgbrowser.h.

◆ IDS_INVALID_FILENAME

#define IDS_INVALID_FILENAME   121

Definition at line 107 of file filedlgbrowser.h.

◆ IDS_INVALID_FILENAME_TITLE

#define IDS_INVALID_FILENAME_TITLE   120

Definition at line 106 of file filedlgbrowser.h.

◆ IDS_INVALID_FOLDERNAME

#define IDS_INVALID_FOLDERNAME   124

Definition at line 110 of file filedlgbrowser.h.

◆ IDS_LISTVIEW

#define IDS_LISTVIEW   152

Definition at line 116 of file filedlgbrowser.h.

◆ IDS_NEWFOLDER

#define IDS_NEWFOLDER   151

Definition at line 115 of file filedlgbrowser.h.

◆ IDS_OVERWRITEFILE

#define IDS_OVERWRITEFILE   119

Definition at line 105 of file filedlgbrowser.h.

◆ IDS_PATHNOTEXISTING

#define IDS_PATHNOTEXISTING   122

Definition at line 108 of file filedlgbrowser.h.

◆ IDS_REPORTVIEW

#define IDS_REPORTVIEW   153

Definition at line 117 of file filedlgbrowser.h.

◆ IDS_TODESKTOP

#define IDS_TODESKTOP   154

Definition at line 118 of file filedlgbrowser.h.

◆ IDS_UPFOLDER

#define IDS_UPFOLDER   150

Definition at line 114 of file filedlgbrowser.h.

◆ IDS_VERIFYFILE

#define IDS_VERIFYFILE   115

Definition at line 103 of file filedlgbrowser.h.

Function Documentation

◆ FILEDLG95_FILENAME_FillFromSelection()

void FILEDLG95_FILENAME_FillFromSelection ( HWND  hwnd)

Definition at line 3788 of file filedlg.c.

3789 {
3791  LPITEMIDLIST pidl;
3792  LPWSTR lpstrAllFiles, lpstrTmp;
3793  UINT nFiles = 0, nFileToOpen, nFileSelected, nAllFilesLength = 0, nThisFileLength, nAllFilesMaxLength;
3794  STGMEDIUM medium;
3795  LPIDA cida;
3796  FORMATETC formatetc = get_def_format();
3797 
3798  TRACE("\n");
3799 
3800  if (FAILED(IDataObject_GetData(fodInfos->Shell.FOIDataObject, &formatetc, &medium)))
3801  return;
3802 
3803  cida = GlobalLock(medium.u.hGlobal);
3804  nFileSelected = cida->cidl;
3805 
3806  /* Allocate a buffer */
3807  nAllFilesMaxLength = MAX_PATH + 3;
3808  lpstrAllFiles = heap_alloc_zero(nAllFilesMaxLength * sizeof(WCHAR));
3809  if (!lpstrAllFiles)
3810  goto ret;
3811 
3812  /* Loop through the selection, handle only files (not folders) */
3813  for (nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++)
3814  {
3815  pidl = (LPITEMIDLIST)((LPBYTE)cida + cida->aoffset[nFileToOpen + 1]);
3816  if (pidl)
3817  {
3818  if (!IsPidlFolder(fodInfos->Shell.FOIShellFolder, pidl))
3819  {
3820  if (nAllFilesLength + MAX_PATH + 3 > nAllFilesMaxLength)
3821  {
3822  nAllFilesMaxLength *= 2;
3823  lpstrTmp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpstrAllFiles, nAllFilesMaxLength * sizeof(WCHAR));
3824  if (!lpstrTmp)
3825  goto ret;
3826  lpstrAllFiles = lpstrTmp;
3827  }
3828  nFiles += 1;
3829  lpstrAllFiles[nAllFilesLength++] = '"';
3830  GetName(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, lpstrAllFiles + nAllFilesLength);
3831  nThisFileLength = lstrlenW(lpstrAllFiles + nAllFilesLength);
3832  nAllFilesLength += nThisFileLength;
3833  lpstrAllFiles[nAllFilesLength++] = '"';
3834  lpstrAllFiles[nAllFilesLength++] = ' ';
3835  }
3836  }
3837  }
3838 
3839  if (nFiles != 0)
3840  {
3841  /* If there's only one file, use the name as-is without quotes */
3842  lpstrTmp = lpstrAllFiles;
3843  if (nFiles == 1)
3844  {
3845  lpstrTmp += 1;
3846  lpstrTmp[nThisFileLength] = 0;
3847  }
3848  SetWindowTextW(fodInfos->DlgInfos.hwndFileName, lpstrTmp);
3849  /* Select the file name like Windows does */
3850  if (filename_is_edit(fodInfos))
3851  SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, -1);
3852  }
3853 
3854 ret:
3855  heap_free(lpstrAllFiles);
3856  COMCTL32_ReleaseStgMedium(medium);
3857 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl, DWORD dwFlags, LPWSTR lpstrFileName)
Definition: filedlg.c:4012
struct FileOpenDlgInfos::@325 Shell
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static void COMCTL32_ReleaseStgMedium(STGMEDIUM medium)
Definition: filedlg.c:3926
#define lstrlenW
Definition: compat.h:407
static FORMATETC get_def_format(void)
Definition: filedlg.c:3769
unsigned char * LPBYTE
Definition: typedefs.h:52
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define EM_SETSEL
Definition: winuser.h:1979
UINT cidl
Definition: shlobj.h:491
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HeapReAlloc
Definition: compat.h:393
UINT aoffset[1]
Definition: shlobj.h:492
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static BOOL IsPidlFolder(LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
Definition: filedlg.c:4113
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static BOOL filename_is_edit(const FileOpenDlgInfos *info)
Definition: filedlg.c:1510
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156
Definition: shlobj.h:490
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 3634 of file filedlg.c.

3635 {
3636  int iItemPos;
3637  LookInInfos *liInfos;
3638 
3639  TRACE("%p, %p\n", hwnd, pidl);
3640 
3642 
3643  liInfos = GetPropA(hwnd,LookInInfosStr);
3644 
3645  if(iItemPos < 0)
3646  {
3649  }
3650 
3651  else
3652  {
3653  SFOLDER *tmpFolder = (LPSFOLDER) CBGetItemDataPtr(hwnd,iItemPos);
3654  while(liInfos->iMaxIndentation > tmpFolder->m_iIndent)
3655  {
3656  int iRemovedItem;
3657 
3658  if(-1 == (iRemovedItem = FILEDLG95_LOOKIN_RemoveMostExpandedItem(hwnd)))
3659  break;
3660  if(iRemovedItem < iItemPos)
3661  iItemPos--;
3662  }
3663  }
3664 
3665  SendMessageW(hwnd, CB_SETCURSEL, iItemPos, 0);
3666  liInfos->uSelectedItem = iItemPos;
3667 
3668  return 0;
3669 
3670 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const char LookInInfosStr[]
Definition: filedlg.c:144
static int FILEDLG95_LOOKIN_SearchItem(HWND hwnd, WPARAM searchArg, int iSearchMethod)
Definition: filedlg.c:3707
UINT_PTR WPARAM
Definition: windef.h:207
int iMaxIndentation
Definition: filedlg.c:106
#define SEARCH_PIDL
Definition: filedlg.c:122
#define CBGetItemDataPtr(hwnd, iItemId)
Definition: filedlg.c:141
#define TRACE(s)
Definition: solgame.cpp:4
int m_iIndent
Definition: filedlg.c:99
#define CB_SETCURSEL
Definition: winuser.h:1922
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:3677
UINT uSelectedItem
Definition: filedlg.c:107
static int FILEDLG95_LOOKIN_InsertItemAfterParent(HWND hwnd, LPITEMIDLIST pidl)
Definition: filedlg.c:3605
struct SFolder * LPSFOLDER

Referenced by IShellBrowserImpl_BrowseObject().

◆ get_filedlg_infoptr()

◆ GetParentPidl()

LPITEMIDLIST GetParentPidl ( LPITEMIDLIST  pidl)

Definition at line 4069 of file filedlg.c.

4070 {
4071  LPITEMIDLIST pidlParent;
4072 
4073  TRACE("%p\n", pidl);
4074 
4075  pidlParent = ILClone(pidl);
4076  ILRemoveLastID(pidlParent);
4077 
4078  return pidlParent;
4079 }
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 3946 of file filedlg.c.

3947 {
3948 
3949  STGMEDIUM medium;
3950  FORMATETC formatetc = get_def_format();
3951  LPITEMIDLIST pidl = NULL;
3952 
3953  TRACE("sv=%p index=%u\n", doSelected, nPidlIndex);
3954 
3955  if (!doSelected)
3956  return NULL;
3957 
3958  /* Get the pidls from IDataObject */
3959  if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
3960  {
3961  LPIDA cida = GlobalLock(medium.u.hGlobal);
3962  if(nPidlIndex <= cida->cidl)
3963  {
3964  pidl = ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[nPidlIndex]]));
3965  }
3966  COMCTL32_ReleaseStgMedium(medium);
3967  }
3968  return pidl;
3969 }
static void COMCTL32_ReleaseStgMedium(STGMEDIUM medium)
Definition: filedlg.c:3926
static FORMATETC get_def_format(void)
Definition: filedlg.c:3769
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
#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
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: shlobj.h:490

Referenced by BrowseSelectedFolder(), and IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand().

◆ GetShellFolderFromPidl()

IShellFolder* GetShellFolderFromPidl ( LPITEMIDLIST  pidlAbs)

Definition at line 4041 of file filedlg.c.

4042 {
4043  IShellFolder *psf = NULL,*psfParent;
4044 
4045  TRACE("%p\n", pidlAbs);
4046 
4047  if(SUCCEEDED(SHGetDesktopFolder(&psfParent)))
4048  {
4049  psf = psfParent;
4050  if(pidlAbs && pidlAbs->mkid.cb)
4051  {
4052  if(SUCCEEDED(IShellFolder_BindToObject(psfParent, pidlAbs, NULL, &IID_IShellFolder, (LPVOID*)&psf)))
4053  {
4054  IShellFolder_Release(psfParent);
4055  return psf;
4056  }
4057  }
4058  /* return the desktop */
4059  return psfParent;
4060  }
4061  return NULL;
4062 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by IShellBrowserImpl_BrowseObject().

◆ IShellBrowserImpl_Construct()

IShellBrowser* IShellBrowserImpl_Construct ( HWND  hwndOwner)

Definition at line 193 of file filedlgbrowser.c.

194 {
195  FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndOwner);
197 
198  sb = heap_alloc(sizeof(*sb));
199 
200  /* Initialisation of the member variables */
201  sb->ref=1;
202  sb->hwndOwner = hwndOwner;
203 
204  /* Initialisation of the vTables */
205  sb->IShellBrowser_iface.lpVtbl = &IShellBrowserImpl_Vtbl;
206  sb->ICommDlgBrowser_iface.lpVtbl = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
207  sb->IServiceProvider_iface.lpVtbl = &IShellBrowserImpl_IServiceProvider_Vtbl;
209  &fodInfos->ShellInfos.pidlAbsCurrent);
210 
211  TRACE("%p\n", sb);
212 
213  return &sb->IShellBrowser_iface;
214 }
struct FileOpenDlgInfos::@326 ShellInfos
superblock * sb
Definition: btrfs.c:3876
#define CSIDL_DESKTOP
Definition: shlobj.h:2003
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:2687
static const IServiceProviderVtbl IShellBrowserImpl_IServiceProvider_Vtbl
static const ICommDlgBrowserVtbl IShellBrowserImpl_ICommDlgBrowser_Vtbl
FileOpenDlgInfos * get_filedlg_infoptr(HWND hwnd)
Definition: filedlg.c:156

Referenced by FILEDLG95_SHELL_Init().

◆ SendCustomDlgNotificationMessage()

LRESULT SendCustomDlgNotificationMessage ( HWND  hwndParentDlg,
UINT  uCode 
)

Definition at line 985 of file filedlg.c.

986 {
987  FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndParentDlg);
988  LRESULT hook_result;
989  OFNOTIFYW ofnNotify;
990 
991  TRACE("%p %d\n", hwndParentDlg, uCode);
992 
993  if (!fodInfos || !fodInfos->DlgInfos.hwndCustomDlg)
994  return 0;
995 
996  TRACE("CALL NOTIFY for %d\n", uCode);
997 
998  ofnNotify.hdr.hwndFrom = hwndParentDlg;
999  ofnNotify.hdr.idFrom = 0;
1000  ofnNotify.hdr.code = uCode;
1001  ofnNotify.lpOFN = fodInfos->ofnInfos;
1002  ofnNotify.pszFile = NULL;
1003 
1004  if (fodInfos->unicode)
1005  hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify);
1006  else
1007  hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg, WM_NOTIFY, 0, (LPARAM)&ofnNotify);
1008 
1009  TRACE("RET NOTIFY retval %#lx\n", hook_result);
1010 
1011  return hook_result;
1012 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT code
Definition: winuser.h:3112
UINT_PTR idFrom
Definition: winuser.h:3111
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
LPOPENFILENAMEW ofnInfos
struct FileOpenDlgInfos::@327 DlgInfos
#define TRACE(s)
Definition: solgame.cpp:4
NMHDR hdr
Definition: commdlg.h:411
LPOPENFILENAMEW lpOFN
Definition: commdlg.h:412
HWND hwndFrom
Definition: winuser.h:3110
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
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:156

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().