mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 09:21:14 +00:00
- 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:
parent
2e011a5243
commit
e2f4aefb38
8 changed files with 896 additions and 924 deletions
|
@ -106,16 +106,25 @@ extern BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
|
|||
extern BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR);
|
||||
extern HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *);
|
||||
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 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 */
|
||||
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 BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y);
|
||||
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);
|
||||
|
|
|
@ -40,18 +40,27 @@ BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
|
|||
BOOL (WINAPI *COMDLG32_SHGetPathFromIDListA) (LPCITEMIDLIST,LPSTR);
|
||||
HRESULT (WINAPI *COMDLG32_SHGetSpecialFolderLocation)(HWND,INT,LPITEMIDLIST *);
|
||||
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);
|
||||
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_StrRetToBufW)(LPSTRRET,LPITEMIDLIST,LPWSTR,DWORD);
|
||||
BOOL (WINAPI *COMDLG32_SHGetSpecialFolderPathA)(HWND hwndOwner,LPSTR szPath,DWORD csidl,BOOL bCreate);
|
||||
|
||||
/* PATH */
|
||||
BOOL (WINAPI *COMDLG32_PathIsRootA)(LPCSTR x);
|
||||
LPCSTR (WINAPI *COMDLG32_PathFindFilenameA)(LPCSTR path);
|
||||
LPSTR (WINAPI *COMDLG32_PathFindFileNameA)(LPCSTR path);
|
||||
DWORD (WINAPI *COMDLG32_PathRemoveFileSpecA)(LPSTR fn);
|
||||
BOOL (WINAPI *COMDLG32_PathMatchSpecW)(LPCWSTR x, LPCWSTR y);
|
||||
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)
|
||||
|
@ -95,9 +104,9 @@ BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Res
|
|||
|
||||
COMDLG32_TlsIndex = 0xffffffff;
|
||||
|
||||
COMCTL32_hInstance = LoadLibraryA("COMCTL32.DLL");
|
||||
SHELL32_hInstance = LoadLibraryA("SHELL32.DLL");
|
||||
SHLWAPI_hInstance = LoadLibraryA("SHLWAPI.DLL");
|
||||
COMCTL32_hInstance = GetModuleHandleA("COMCTL32.DLL");
|
||||
SHELL32_hInstance = GetModuleHandleA("SHELL32.DLL");
|
||||
SHLWAPI_hInstance = GetModuleHandleA("SHLWAPI.DLL");
|
||||
|
||||
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_SHGetDesktopFolder = (void*)GetProcAddress(SHELL32_hInstance,"SHGetDesktopFolder");
|
||||
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 ###
|
||||
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_PathIsRootA = (void*)GetProcAddress(SHLWAPI_hInstance,"PathIsRootA");
|
||||
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_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;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
|
@ -151,9 +171,6 @@ BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Res
|
|||
FreeLibrary16(COMDLG32_hInstance16);
|
||||
|
||||
}
|
||||
FreeLibrary(COMCTL32_hInstance);
|
||||
FreeLibrary(SHELL32_hInstance);
|
||||
FreeLibrary(SHLWAPI_hInstance);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
@ -314,6 +314,11 @@ STRINGTABLE DISCARDABLE
|
|||
IDS_FILENOTFOUND "File not found"
|
||||
IDS_VERIFYFILE "Please verify if the correct file name was given"
|
||||
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
|
||||
|
|
|
@ -5,7 +5,9 @@ rsrc comdlg32
|
|||
import winspool.drv
|
||||
|
||||
import shell32.dll
|
||||
import shlwapi.dll
|
||||
import comctl32.dll
|
||||
import user32.dll
|
||||
import winspool.drv
|
||||
|
||||
0 stub ArrowBtnWndProc
|
||||
|
@ -33,3 +35,5 @@ import winspool.drv
|
|||
22 stub dwLBSubclass
|
||||
23 stub dwOKSubclass
|
||||
|
||||
@ stdcall PrintDlgExA(ptr)PrintDlgExA
|
||||
@ stdcall PrintDlgExW(ptr)PrintDlgExW
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,16 +18,6 @@
|
|||
|
||||
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
|
||||
*/
|
||||
|
@ -196,7 +186,7 @@ ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
|
|||
|
||||
if (!--(This->ref))
|
||||
{
|
||||
COMDLG32_SHFree(This);
|
||||
HeapFree(GetProcessHeap(),0, This);
|
||||
return 0;
|
||||
}
|
||||
return This->ref;
|
||||
|
@ -270,7 +260,7 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
|||
|
||||
ICOM_THIS(IShellBrowserImpl, iface);
|
||||
|
||||
TRACE("(%p)\n", This);
|
||||
TRACE("(%p)(%p,0x%08x)\n", This, pidl, wFlags);
|
||||
|
||||
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
|
||||
|
||||
|
@ -301,12 +291,13 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
|||
psfTmp = GetShellFolderFromPidl(pidlTmp);
|
||||
|
||||
}
|
||||
else
|
||||
else /* SBSP_ABSOLUTE is 0x0000 */
|
||||
{
|
||||
/* An absolute pidl (relative from the desktop) */
|
||||
pidlTmp = COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
|
||||
psfTmp = GetShellFolderFromPidl(pidlTmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Retrieve the IShellFolder interface of the pidl specified folder */
|
||||
|
@ -322,8 +313,16 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
|||
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 */
|
||||
IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
|
||||
if (fodInfos->Shell.FOIShellFolder)
|
||||
IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
|
||||
fodInfos->Shell.FOIShellFolder = psfTmp;
|
||||
|
||||
/* Create the associated view */
|
||||
|
@ -334,6 +333,11 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
|||
{
|
||||
HWND hwndView;
|
||||
HWND hDlgWnd;
|
||||
BOOL bViewHasFocus;
|
||||
|
||||
/* Check if listview has focus */
|
||||
bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
|
||||
|
||||
/* Get the foldersettings from the old view */
|
||||
if(fodInfos->Shell.FOIShellView)
|
||||
{
|
||||
|
@ -382,6 +386,10 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
|||
hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
|
||||
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;
|
||||
}
|
||||
|
@ -650,18 +658,20 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowse
|
|||
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
|
||||
|
||||
/* 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;
|
||||
|
||||
ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
|
||||
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
|
||||
if (ulAttr)
|
||||
hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
|
||||
/* Tell the dialog that the user selected a file */
|
||||
if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
|
||||
{
|
||||
hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
|
||||
}
|
||||
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 */
|
||||
|
@ -688,6 +698,12 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *
|
|||
switch (uChange)
|
||||
{
|
||||
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;
|
||||
case CDBOSC_KILLFOCUS:
|
||||
{
|
||||
|
@ -699,6 +715,7 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *
|
|||
case CDBOSC_SELCHANGE:
|
||||
return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
|
||||
case CDBOSC_RENAME:
|
||||
/* nothing to do */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -758,20 +775,21 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
|
|||
ulAttr = SFGAO_HIDDEN | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR | SFGAO_LINK;
|
||||
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
|
||||
|
||||
|
||||
if( (ulAttr & SFGAO_HIDDEN) /* hidden */
|
||||
| !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
|
||||
if( (ulAttr & SFGAO_HIDDEN) /* hidden */
|
||||
| !(ulAttr & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR))) /* special folder */
|
||||
return S_FALSE;
|
||||
|
||||
/* always include directorys and links */
|
||||
if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK))
|
||||
return S_OK;
|
||||
|
||||
/* Check if there is a mask to apply if not */
|
||||
if(!fodInfos->ShellInfos.lpstrCurrentFilter ||
|
||||
!lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
|
||||
if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter))
|
||||
return S_OK;
|
||||
|
||||
if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_FORPARSING, &str)))
|
||||
{ if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl)))
|
||||
if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str)))
|
||||
{
|
||||
if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl)))
|
||||
{
|
||||
if (COMDLG32_PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
|
||||
return S_OK;
|
||||
|
@ -787,244 +805,30 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
|
|||
HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
|
||||
{
|
||||
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);
|
||||
|
||||
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
nFileSelected = GetNumSelected( fodInfos->Shell.FOIShellView );
|
||||
/* Count how many files we have */
|
||||
for ( nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++ )
|
||||
{
|
||||
LPITEMIDLIST pidlSelection;
|
||||
ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
|
||||
/* release old selections */
|
||||
if (fodInfos->Shell.FOIDataObject)
|
||||
IDataObject_Release(fodInfos->Shell.FOIDataObject);
|
||||
|
||||
/* get the file selected */
|
||||
EnumSelectedPidls( fodInfos->Shell.FOIShellView, nFileToOpen, &pidlSelection );
|
||||
IShellFolder_GetAttributesOf( fodInfos->Shell.FOIShellFolder, 1, &pidlSelection, &uAttr );
|
||||
|
||||
if (!uAttr)
|
||||
nFiles++;
|
||||
|
||||
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;
|
||||
}
|
||||
/* get a new DataObject from the ShellView */
|
||||
if(FAILED(IShellView_GetItemObject(fodInfos->Shell.FOIShellView, SVGIO_SELECTION,
|
||||
&IID_IDataObject, (LPVOID*)&fodInfos->Shell.FOIDataObject)))
|
||||
return E_FAIL;
|
||||
|
||||
FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner);
|
||||
|
||||
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;
|
||||
|
||||
return nFileSelected ? S_OK : E_FAIL;
|
||||
/* fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW; */
|
||||
SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ typedef struct
|
|||
IShellBrowser *FOIShellBrowser;
|
||||
IShellFolder *FOIShellFolder;
|
||||
IShellView *FOIShellView;
|
||||
IDataObject *FOIDataObject;
|
||||
} Shell;
|
||||
|
||||
struct {
|
||||
|
@ -87,6 +88,11 @@ typedef struct
|
|||
#define IDS_CREATEFILE 116
|
||||
#define IDS_CREATEFOLDER_DENIED 117
|
||||
#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 */
|
||||
|
||||
|
@ -212,9 +218,14 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *
|
|||
LPCITEMIDLIST pidl);
|
||||
|
||||
|
||||
LPITEMIDLIST GetPidlFromDataObject ( IDataObject *doSelected, UINT nPidlIndex);
|
||||
UINT GetNumSelected(IDataObject *doSelected);
|
||||
|
||||
LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
|
||||
BOOL EnumSelectedPidls(IShellView *ppshv, UINT nPidlIndex, LPITEMIDLIST *pidlSelected);
|
||||
UINT GetNumSelected(IShellView *ppshv);
|
||||
/* pidl handling */
|
||||
BOOL IsPidlFolder (LPSHELLFOLDER psf, LPITEMIDLIST pidl);
|
||||
|
||||
/* 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*/
|
||||
|
|
|
@ -424,6 +424,7 @@ static void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, LPPRINTER_INFO_2A pi)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* PRINTDLG_ChangePrinter
|
||||
|
@ -1195,3 +1196,19 @@ BOOL16 WINAPI PrintDlg16( LPPRINTDLG16 lpPrint )
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue