- Rewrite of the shell related parts of the dialog to use the already

in shell32implemented functions (ShellFolder/Path*). Eliminated direct
  file access.
- Replaced LoadLibraryA with GetModuleHandleA since comdlg32 is imports
  some dlls per *.spec file
- Most OpenFile Flags (OFN_*) should work properly now
- The edit box should work right with all stuff entered in it like
  ..\temp\file.txt or just c: to change a drive
- Optimized DataObject handling
- Some bugs fixed, should work with native shell32 again.
- Stubs for PrintDlgEx
This commit is contained in:
Juergen Schmied 2000-06-02 19:36:53 +00:00 committed by Alexandre Julliard
parent 2e011a5243
commit e2f4aefb38
8 changed files with 896 additions and 924 deletions

View File

@ -106,16 +106,25 @@ extern BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
extern BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR); extern BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR);
extern HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *); extern HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *);
extern DWORD (WINAPI *COMDLG32_SHGetDesktopFolder)(IShellFolder **); extern DWORD (WINAPI *COMDLG32_SHGetDesktopFolder)(IShellFolder **);
extern DWORD (WINAPI *COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT); extern DWORD (WINAPI *COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT);
extern LPVOID (WINAPI *COMDLG32_SHAlloc)(DWORD); extern LPVOID (WINAPI *COMDLG32_SHAlloc)(DWORD);
extern DWORD (WINAPI *COMDLG32_SHFree)(LPVOID); extern DWORD (WINAPI *COMDLG32_SHFree)(LPVOID);
extern HRESULT (WINAPI *COMDLG32_SHGetDataFromIDListA)(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len);
extern BOOL (WINAPI *COMDLG32_SHGetSpecialFolderPathA)(HWND hwndOwner,LPSTR szPath,DWORD csidl,BOOL bCreate);
/* PATH */ /* PATH */
extern BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x); extern BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x);
extern LPCSTR (WINAPI *COMDLG32_PathFindFilenameA)(LPCSTR path); extern LPSTR (WINAPI *COMDLG32_PathFindFileNameA)(LPCSTR path);
extern DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn); extern DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn);
extern BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y); extern BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y);
extern LPSTR (WINAPI *COMDLG32_PathAddBackslashA)(LPSTR path); extern LPSTR (WINAPI *COMDLG32_PathAddBackslashA)(LPSTR path);
extern BOOL (WINAPI *COMDLG32_PathCanonicalizeA)(LPSTR pszBuf, LPCSTR pszPath);
extern int (WINAPI *COMDLG32_PathGetDriveNumberA)(LPCSTR lpszPath);
extern BOOL (WINAPI *COMDLG32_PathIsRelativeA) (LPCSTR lpszPath);
extern LPSTR (WINAPI *COMDLG32_PathFindNextComponentA)(LPCSTR pszPath);
extern LPWSTR (WINAPI *COMDLG32_PathAddBackslashW)(LPWSTR lpszPath);
extern LPVOID (WINAPI *COMDLG32_PathFindExtensionA)(LPCVOID lpszPath);
extern BOOL (WINAPI *COMDLG32_PathAddExtensionA)(LPSTR pszPath,LPCSTR pszExtension);
extern BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType); extern BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType);

View File

@ -40,18 +40,27 @@ BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR); BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR);
HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *); HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *);
DWORD (WINAPI *COMDLG32_SHGetDesktopFolder)(IShellFolder **); DWORD (WINAPI *COMDLG32_SHGetDesktopFolder)(IShellFolder **);
DWORD (WINAPI *COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT); DWORD (WINAPI *COMDLG32_SHGetFileInfoA)(LPCSTR,DWORD,SHFILEINFOA*,UINT,UINT);
LPVOID (WINAPI *COMDLG32_SHAlloc)(DWORD); LPVOID (WINAPI *COMDLG32_SHAlloc)(DWORD);
DWORD (WINAPI *COMDLG32_SHFree)(LPVOID); DWORD (WINAPI *COMDLG32_SHFree)(LPVOID);
HRESULT (WINAPI *COMDLG32_SHGetDataFromIDListA)(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID dest, int len);
HRESULT (WINAPI *COMDLG32_StrRetToBufA)(LPSTRRET,LPITEMIDLIST,LPSTR,DWORD); HRESULT (WINAPI *COMDLG32_StrRetToBufA)(LPSTRRET,LPITEMIDLIST,LPSTR,DWORD);
HRESULT (WINAPI *COMDLG32_StrRetToBufW)(LPSTRRET,LPITEMIDLIST,LPWSTR,DWORD); HRESULT (WINAPI *COMDLG32_StrRetToBufW)(LPSTRRET,LPITEMIDLIST,LPWSTR,DWORD);
BOOL (WINAPI *COMDLG32_SHGetSpecialFolderPathA)(HWND hwndOwner,LPSTR szPath,DWORD csidl,BOOL bCreate);
/* PATH */ /* PATH */
BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x); BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x);
LPCSTR (WINAPI *COMDLG32_PathFindFilenameA)(LPCSTR path); LPSTR (WINAPI *COMDLG32_PathFindFileNameA)(LPCSTR path);
DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn); DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn);
BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y); BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y);
LPSTR (WINAPI *COMDLG32_PathAddBackslashA)(LPSTR path); LPSTR (WINAPI *COMDLG32_PathAddBackslashA)(LPSTR path);
BOOL (WINAPI *COMDLG32_PathCanonicalizeA)(LPSTR pszBuf, LPCSTR pszPath);
int (WINAPI *COMDLG32_PathGetDriveNumberA)(LPCSTR lpszPath);
BOOL (WINAPI *COMDLG32_PathIsRelativeA) (LPCSTR lpszPath);
LPSTR (WINAPI *COMDLG32_PathFindNextComponentA)(LPCSTR pszPath);
LPWSTR (WINAPI *COMDLG32_PathAddBackslashW)(LPWSTR lpszPath);
LPVOID (WINAPI *COMDLG32_PathFindExtensionA)(LPCVOID lpszPath);
BOOL (WINAPI *COMDLG32_PathAddExtensionA)(LPSTR pszPath,LPCSTR pszExtension);
/*********************************************************************** /***********************************************************************
* COMDLG32_DllEntryPoint (COMDLG32.entry) * COMDLG32_DllEntryPoint (COMDLG32.entry)
@ -95,9 +104,9 @@ BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Res
COMDLG32_TlsIndex = 0xffffffff; COMDLG32_TlsIndex = 0xffffffff;
COMCTL32_hInstance = LoadLibraryA("COMCTL32.DLL"); COMCTL32_hInstance = GetModuleHandleA("COMCTL32.DLL");
SHELL32_hInstance = LoadLibraryA("SHELL32.DLL"); SHELL32_hInstance = GetModuleHandleA("SHELL32.DLL");
SHLWAPI_hInstance = LoadLibraryA("SHLWAPI.DLL"); SHLWAPI_hInstance = GetModuleHandleA("SHLWAPI.DLL");
if (!COMCTL32_hInstance || !SHELL32_hInstance || !SHLWAPI_hInstance) if (!COMCTL32_hInstance || !SHELL32_hInstance || !SHLWAPI_hInstance)
{ {
@ -124,6 +133,10 @@ BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Res
COMDLG32_SHGetPathFromIDListA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetPathFromIDListA"); COMDLG32_SHGetPathFromIDListA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetPathFromIDListA");
COMDLG32_SHGetDesktopFolder = (void*)GetProcAddress(SHELL32_hInstance,"SHGetDesktopFolder"); COMDLG32_SHGetDesktopFolder = (void*)GetProcAddress(SHELL32_hInstance,"SHGetDesktopFolder");
COMDLG32_SHGetFileInfoA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetFileInfoA"); COMDLG32_SHGetFileInfoA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetFileInfoA");
COMDLG32_SHGetDataFromIDListA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetDataFromIDListA");
/* FIXME: we cant import SHGetSpecialFolderPathA from all versions of shell32 */
COMDLG32_SHGetSpecialFolderPathA = (void*)GetProcAddress(SHELL32_hInstance,"SHGetSpecialFolderPathA");
/* ### WARINIG ### /* ### WARINIG ###
We can't do a GetProcAddress to link to StrRetToBuf[A|W] sine not all We can't do a GetProcAddress to link to StrRetToBuf[A|W] sine not all
@ -136,8 +149,15 @@ BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Res
COMDLG32_PathMatchSpecW = (void*)GetProcAddress(SHLWAPI_hInstance,"PathMatchSpecW"); COMDLG32_PathMatchSpecW = (void*)GetProcAddress(SHLWAPI_hInstance,"PathMatchSpecW");
COMDLG32_PathIsRootA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathIsRootA"); COMDLG32_PathIsRootA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathIsRootA");
COMDLG32_PathRemoveFileSpecA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathRemoveFileSpecA"); COMDLG32_PathRemoveFileSpecA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathRemoveFileSpecA");
COMDLG32_PathFindFilenameA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathFindFileNameA"); COMDLG32_PathFindFileNameA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathFindFileNameA");
COMDLG32_PathAddBackslashA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathAddBackslashA"); COMDLG32_PathAddBackslashA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathAddBackslashA");
COMDLG32_PathCanonicalizeA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathCanonicalizeA");
COMDLG32_PathGetDriveNumberA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathGetDriveNumberA");
COMDLG32_PathIsRelativeA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathIsRelativeA");
COMDLG32_PathFindNextComponentA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathFindNextComponentA");
COMDLG32_PathAddBackslashW = (void*)GetProcAddress(SHLWAPI_hInstance,"PathAddBackslashW");
COMDLG32_PathFindExtensionA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathFindExtensionA");
COMDLG32_PathAddExtensionA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathAddExtensionA");
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
@ -151,9 +171,6 @@ BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Res
FreeLibrary16(COMDLG32_hInstance16); FreeLibrary16(COMDLG32_hInstance16);
} }
FreeLibrary(COMCTL32_hInstance);
FreeLibrary(SHELL32_hInstance);
FreeLibrary(SHLWAPI_hInstance);
break; break;
} }
return TRUE; return TRUE;

View File

@ -314,6 +314,11 @@ STRINGTABLE DISCARDABLE
IDS_FILENOTFOUND "File not found" IDS_FILENOTFOUND "File not found"
IDS_VERIFYFILE "Please verify if the correct file name was given" IDS_VERIFYFILE "Please verify if the correct file name was given"
IDS_CREATEFILE "File does not exist\nDo you want to create file" IDS_CREATEFILE "File does not exist\nDo you want to create file"
IDL_OVERWRITEFILE "File does already exist.\nDo you want to replace it?"
IDS_INVALID_FILENAME_TITLE "Invalid character(s) in path"
IDS_INVALID_FILENAME "A filename cannot contain any of the following characters: \n / : < > |"
IDS_PATHNOTEXISTING "Path does not exist"
IDS_FILENOTEXISTING "File does not exist"
} }
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE

View File

@ -5,7 +5,9 @@ rsrc comdlg32
import winspool.drv import winspool.drv
import shell32.dll import shell32.dll
import shlwapi.dll
import comctl32.dll import comctl32.dll
import user32.dll
import winspool.drv import winspool.drv
0 stub ArrowBtnWndProc 0 stub ArrowBtnWndProc
@ -33,3 +35,5 @@ import winspool.drv
22 stub dwLBSubclass 22 stub dwLBSubclass
23 stub dwOKSubclass 23 stub dwOKSubclass
@ stdcall PrintDlgExA(ptr)PrintDlgExA
@ stdcall PrintDlgExW(ptr)PrintDlgExW

File diff suppressed because it is too large Load Diff

View File

@ -18,16 +18,6 @@
DEFAULT_DEBUG_CHANNEL(commdlg) DEFAULT_DEBUG_CHANNEL(commdlg)
#define SETDefFormatEtc(fe,cf,med) \
{ \
(fe).cfFormat = cf;\
(fe).dwAspect = DVASPECT_CONTENT; \
(fe).ptd =NULL;\
(fe).tymed = med;\
(fe).lindex = -1;\
};
/************************************************************************** /**************************************************************************
* Structure * Structure
*/ */
@ -196,7 +186,7 @@ ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
if (!--(This->ref)) if (!--(This->ref))
{ {
COMDLG32_SHFree(This); HeapFree(GetProcessHeap(),0, This);
return 0; return 0;
} }
return This->ref; return This->ref;
@ -270,7 +260,7 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
ICOM_THIS(IShellBrowserImpl, iface); ICOM_THIS(IShellBrowserImpl, iface);
TRACE("(%p)\n", This); TRACE("(%p)(%p,0x%08x)\n", This, pidl, wFlags);
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
@ -301,12 +291,13 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
psfTmp = GetShellFolderFromPidl(pidlTmp); psfTmp = GetShellFolderFromPidl(pidlTmp);
} }
else else /* SBSP_ABSOLUTE is 0x0000 */
{ {
/* An absolute pidl (relative from the desktop) */ /* An absolute pidl (relative from the desktop) */
pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl); pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
psfTmp = GetShellFolderFromPidl(pidlTmp); psfTmp = GetShellFolderFromPidl(pidlTmp);
} }
/* Retrieve the IShellFolder interface of the pidl specified folder */ /* Retrieve the IShellFolder interface of the pidl specified folder */
@ -322,8 +313,16 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
return NOERROR; return NOERROR;
} }
/* Release the current DataObject */
if (fodInfos->Shell.FOIDataObject)
{
IDataObject_Release(fodInfos->Shell.FOIDataObject);
fodInfos->Shell.FOIDataObject = NULL;
}
/* Release the current fodInfos->Shell.FOIShellFolder and update its value */ /* Release the current fodInfos->Shell.FOIShellFolder and update its value */
IShellFolder_Release(fodInfos->Shell.FOIShellFolder); if (fodInfos->Shell.FOIShellFolder)
IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
fodInfos->Shell.FOIShellFolder = psfTmp; fodInfos->Shell.FOIShellFolder = psfTmp;
/* Create the associated view */ /* Create the associated view */
@ -334,6 +333,11 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
{ {
HWND hwndView; HWND hwndView;
HWND hDlgWnd; HWND hDlgWnd;
BOOL bViewHasFocus;
/* Check if listview has focus */
bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
/* Get the foldersettings from the old view */ /* Get the foldersettings from the old view */
if(fodInfos->Shell.FOIShellView) if(fodInfos->Shell.FOIShellView)
{ {
@ -382,6 +386,10 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN); hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
/* Since we destroyed the old view if it had focus set focus
to the newly created view */
if (bViewHasFocus)
SetFocus(fodInfos->ShellInfos.hwndView);
return NOERROR; return NOERROR;
} }
@ -650,18 +658,20 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowse
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
/* If the selected object is not a folder, send a IDOK command to parent window */ /* If the selected object is not a folder, send a IDOK command to parent window */
if((pidl = GetSelectedPidl(ppshv))) if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1)))
{ {
HRESULT hRes; HRESULT hRes;
ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
if (ulAttr) if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE); {
/* Tell the dialog that the user selected a file */ hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
}
else else
{ {
hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L); /* Tell the dialog that the user selected a file */
hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
} }
/* Free memory used by pidl */ /* Free memory used by pidl */
@ -688,6 +698,12 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *
switch (uChange) switch (uChange)
{ {
case CDBOSC_SETFOCUS: case CDBOSC_SETFOCUS:
/* FIXME: Reset the default button.
This should be taken care of by defdlg. If control
other than button receives focus the default button
should be restored. */
SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0);
break; break;
case CDBOSC_KILLFOCUS: case CDBOSC_KILLFOCUS:
{ {
@ -699,6 +715,7 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *
case CDBOSC_SELCHANGE: case CDBOSC_SELCHANGE:
return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv); return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
case CDBOSC_RENAME: case CDBOSC_RENAME:
/* nothing to do */
break; break;
} }
@ -758,20 +775,21 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK; ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK;
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
if( (ulAttr & SFGAO_HIDDEN) /* hidden */
if( (ulAttr & SFGAO_HIDDEN) /* hidden */ | !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
| !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
return S_FALSE; return S_FALSE;
/* always include directorys and links */ /* always include directorys and links */
if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK))
return S_OK; return S_OK;
/* Check if there is a mask to apply if not */ /* Check if there is a mask to apply if not */
if(!fodInfos->ShellInfos.lpstrCurrentFilter || if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
!lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
return S_OK; return S_OK;
if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_FORPARSING, &str))) if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str)))
{ if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl))) {
if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl)))
{ {
if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter)) if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
return S_OK; return S_OK;
@ -787,244 +805,30 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv) HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
{ {
FileOpenDlgInfos *fodInfos; FileOpenDlgInfos *fodInfos;
UINT nFileSelected;
UINT nFileToOpen;
UINT nFiles = 0;
char lpstrFileList[MAX_PATH];
char lpstrTemp[MAX_PATH];
LPSTR lpstrCurrFile = lpstrFileList;
_ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface); _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
nFileSelected = GetNumSelected( fodInfos->Shell.FOIShellView ); /* release old selections */
/* Count how many files we have */ if (fodInfos->Shell.FOIDataObject)
for ( nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++ ) IDataObject_Release(fodInfos->Shell.FOIDataObject);
{
LPITEMIDLIST pidlSelection;
ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
/* get the file selected */ /* get a new DataObject from the ShellView */
EnumSelectedPidls( fodInfos->Shell.FOIShellView, nFileToOpen, &pidlSelection ); if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION,
IShellFolder_GetAttributesOf( fodInfos->Shell.FOIShellFolder, 1, &pidlSelection, &uAttr ); &IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject)))
return E_FAIL;
if (!uAttr)
nFiles++; FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner);
COMDLG32_SHFree( (LPVOID) pidlSelection );
}
/* Generate the string for the edit control */
ZeroMemory(lpstrFileList, MAX_PATH);
if (nFiles)
{
for ( nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++ )
{
LPITEMIDLIST pidlSelection;
ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
memset( lpstrTemp, 0x0, MAX_PATH * sizeof(char) );
/* get the file selected */
EnumSelectedPidls( fodInfos->Shell.FOIShellView, nFileToOpen, &pidlSelection );
GetName( fodInfos->Shell.FOIShellFolder, pidlSelection, SHGDN_NORMAL, lpstrTemp );
IShellFolder_GetAttributesOf( fodInfos->Shell.FOIShellFolder, 1, &pidlSelection, &uAttr );
if ( uAttr & SFGAO_FOLDER ) /* Ignore folders */
continue;
if (nFiles > 1) /* Quote files if we have more than one */
{
*lpstrCurrFile++ = '\"';
lstrcpyA( lpstrCurrFile, lpstrTemp );
lpstrCurrFile += lstrlenA( lpstrTemp );
lstrcpyA( lpstrCurrFile, "\" " );
lpstrCurrFile += 2;
}
else
{
lstrcpyA( lpstrCurrFile, lpstrTemp );
}
COMDLG32_SHFree( (LPVOID) pidlSelection );
}
SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileList);
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
else
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open");
fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW;
SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
return S_OK;
}
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
else
SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open");
fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; /* fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW; */
SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
return nFileSelected ? S_OK : E_FAIL; return S_OK;
} }
/***********************************************************************
* GetSelectedPidl
*
* Return the pidl of the first selected item in the view
*/
LPITEMIDLIST GetSelectedPidl(IShellView *ppshv)
{
IDataObject *doSelected;
LPITEMIDLIST pidlSelected = NULL;
TRACE("sv=%p\n", ppshv);
/* Get an IDataObject from the view */
if(SUCCEEDED(IShellView_GetItemObject(ppshv,
SVGIO_SELECTION,
&IID_IDataObject,
(LPVOID *)&doSelected)))
{
STGMEDIUM medium;
FORMATETC formatetc;
/* Set the FORMATETC structure*/
SETDefFormatEtc(formatetc,
RegisterClipboardFormatA(CFSTR_SHELLIDLIST),
TYMED_HGLOBAL);
/* Get the pidl from IDataObject */
if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
{
LPIDA cida = GlobalLock(medium.u.hGlobal);
TRACE("cida=%p\n", cida);
pidlSelected = COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[1]]));
if(medium.pUnkForRelease)
IUnknown_Release(medium.pUnkForRelease);
else
{
GlobalUnlock(medium.u.hGlobal);
GlobalFree(medium.u.hGlobal);
}
}
IDataObject_Release(doSelected);
return pidlSelected;
}
return NULL;
}
/***********************************************************************
* EnumSelectedPidls
*
* Return the pidl(s) of the selected item(s) in the view.
*
*/
BOOL EnumSelectedPidls( IShellView *ppshv, /*[in]*/
UINT nPidlIndex, /*[in]*/
LPITEMIDLIST *pidlSelected /*[out]*/ )
{
IDataObject *doSelected;
BOOL retVal = TRUE;
/* Get an IDataObject from the view */
if(SUCCEEDED(IShellView_GetItemObject(ppshv,
SVGIO_SELECTION,
&IID_IDataObject,
(LPVOID *)&doSelected)))
{
STGMEDIUM medium;
FORMATETC formatetc;
/* Set the FORMATETC structure*/
SETDefFormatEtc(formatetc,
RegisterClipboardFormatA(CFSTR_SHELLIDLIST),
TYMED_HGLOBAL);
/* Get the pidls from IDataObject */
if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
{
LPIDA cida = GlobalLock(medium.u.hGlobal);
if(nPidlIndex < cida->cidl)
{
*pidlSelected = COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[nPidlIndex + 1]]));
}
else
{
retVal = FALSE;
}
if(medium.pUnkForRelease)
{
IUnknown_Release(medium.pUnkForRelease);
}
else
{
GlobalUnlock(medium.u.hGlobal);
GlobalFree(medium.u.hGlobal);
}
}
IDataObject_Release(doSelected);
return retVal;
}
return FALSE;
}
/***********************************************************************
* GetNumSelected
*
* Return the number of selected items in the view.
*
*/
UINT GetNumSelected( IShellView *ppshv )
{
IDataObject *doSelected;
UINT retVal = 0;
/* Get an IDataObject from the view */
if(SUCCEEDED(IShellView_GetItemObject(ppshv,
SVGIO_SELECTION,
&IID_IDataObject,
(LPVOID *)&doSelected)))
{
STGMEDIUM medium;
FORMATETC formatetc;
/* Set the FORMATETC structure*/
SETDefFormatEtc(formatetc,
RegisterClipboardFormatA(CFSTR_SHELLIDLIST),
TYMED_HGLOBAL);
/* Get the pidls from IDataObject */
if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
{
LPIDA cida = GlobalLock(medium.u.hGlobal);
retVal = cida->cidl;
if(medium.pUnkForRelease)
{
IUnknown_Release(medium.pUnkForRelease);
}
else
{
GlobalUnlock(medium.u.hGlobal);
GlobalFree(medium.u.hGlobal);
}
}
IDataObject_Release(doSelected);
return retVal;
}
return 0;
}

View File

@ -46,6 +46,7 @@ typedef struct
IShellBrowser *FOIShellBrowser; IShellBrowser *FOIShellBrowser;
IShellFolder *FOIShellFolder; IShellFolder *FOIShellFolder;
IShellView *FOIShellView; IShellView *FOIShellView;
IDataObject *FOIDataObject;
} Shell; } Shell;
struct { struct {
@ -87,6 +88,11 @@ typedef struct
#define IDS_CREATEFILE 116 #define IDS_CREATEFILE 116
#define IDS_CREATEFOLDER_DENIED 117 #define IDS_CREATEFOLDER_DENIED 117
#define IDS_FILEOPEN_CAPTION 118 #define IDS_FILEOPEN_CAPTION 118
#define IDL_OVERWRITEFILE 119
#define IDS_INVALID_FILENAME_TITLE 120
#define IDS_INVALID_FILENAME 121
#define IDS_PATHNOTEXISTING 122
#define IDS_FILENOTEXISTING 123
/* File Dialog Tooltips string IDs */ /* File Dialog Tooltips string IDs */
@ -212,9 +218,14 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
LPCITEMIDLIST pidl); LPCITEMIDLIST pidl);
LPITEMIDLIST GetPidlFromDataObject ( IDataObject *doSelected, UINT nPidlIndex);
UINT GetNumSelected(IDataObject *doSelected);
LPITEMIDLIST GetSelectedPidl(IShellView *ppshv); /* pidl handling */
BOOL EnumSelectedPidls(IShellView *ppshv, UINT nPidlIndex, LPITEMIDLIST *pidlSelected); BOOL IsPidlFolder (LPSHELLFOLDER psf, LPITEMIDLIST pidl);
UINT GetNumSelected(IShellView *ppshv);
/* Functions used by the EDIT box */
void FILEDLG95_FILENAME_FillFromSelection (HWND hwnd);
int FILEDLG95_FILENAME_GetFileNames (HWND hwnd, LPSTR * lpstrFileList, UINT * sizeUsed);
#endif /*SHBROWSER_H*/ #endif /*SHBROWSER_H*/

View File

@ -424,6 +424,7 @@ static void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, LPPRINTER_INFO_2A pi)
return; return;
} }
/******************************************************************* /*******************************************************************
* *
* PRINTDLG_ChangePrinter * PRINTDLG_ChangePrinter
@ -1195,3 +1196,19 @@ BOOL16 WINAPI PrintDlg16( LPPRINTDLG16 lpPrint )
return ret; return ret;
} }
/***********************************************************************
* PrintDlgExA
*/
HRESULT WINAPI PrintDlgExA(/*LPPRINTDLGEXA*/ LPVOID lpPrintDlgExA)
{
FIXME("stub\n");
return E_NOTIMPL;
}
/***********************************************************************
* PrintDlgExW
*/
HRESULT WINAPI PrintDlgExW(/*LPPRINTDLGEXW*/ LPVOID lpPrintDlgExW)
{
FIXME("stub\n");
return E_NOTIMPL;
}