From 601c63c9d8869af26da3cf57c8324ee3fa724f40 Mon Sep 17 00:00:00 2001 From: Ricardo Filipe Date: Tue, 16 Dec 2008 00:38:25 +0000 Subject: comdlg32: notify with CDN_INCLUDEITEM on IShellBrowserImpl_ICommDlgBrowser_IncludeObject for each object that is to be included in the browser window --- dlls/comdlg32/filedlg.c | 93 ++++++++++++++++++++++++++++------------ dlls/comdlg32/filedlgbrowser.c | 9 +++- dlls/comdlg32/filedlgbrowser.h | 2 +- include/commdlg.h | 18 +++++++- 4 files changed, 90 insertions(+), 32 deletions(-) diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index e1eedd1..f90c9db 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -821,7 +821,7 @@ static HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) * Send CustomDialogNotification (CDN_FIRST -- CDN_LAST) message to the custom template dialog */ -LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode) +LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode, LPITEMIDLIST pidl) { LRESULT hook_result = 0; FileOpenDlgInfos *fodInfos = GetPropA(hwndParentDlg,FileOpenDlgInfosStr); @@ -832,29 +832,68 @@ LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode) if(fodInfos->DlgInfos.hwndCustomDlg) { - TRACE("CALL NOTIFY for %x\n", uCode); if(fodInfos->unicode) { - OFNOTIFYW ofnNotify; - ofnNotify.hdr.hwndFrom=hwndParentDlg; - ofnNotify.hdr.idFrom=0; - ofnNotify.hdr.code = uCode; - ofnNotify.lpOFN = fodInfos->ofnInfos; - ofnNotify.pszFile = NULL; - hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); + if(uCode == CDN_INCLUDEITEM) + { + OFNOTIFYEXW ofnNotify; + ofnNotify.psf = fodInfos->Shell.FOIShellFolder; + ofnNotify.pidl = pidl; + ofnNotify.hdr.hwndFrom = hwndParentDlg; + ofnNotify.hdr.idFrom = 0; + ofnNotify.hdr.code = uCode; + ofnNotify.lpOFN = fodInfos->ofnInfos; + + TRACE("CALL NOTIFYEX for %x psf=%p pidl=%p\n", uCode, fodInfos->Shell.FOIShellFolder, pidl); + + hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); + } + else + { + OFNOTIFYW ofnNotify; + ofnNotify.pszFile = NULL; + ofnNotify.hdr.hwndFrom = hwndParentDlg; + ofnNotify.hdr.idFrom = 0; + ofnNotify.hdr.code = uCode; + ofnNotify.lpOFN = fodInfos->ofnInfos; + + TRACE("CALL NOTIFY for %x\n", uCode); + + hook_result = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); + } } else { - OFNOTIFYA ofnNotify; - ofnNotify.hdr.hwndFrom=hwndParentDlg; - ofnNotify.hdr.idFrom=0; - ofnNotify.hdr.code = uCode; - ofnNotify.lpOFN = (LPOPENFILENAMEA)fodInfos->ofnInfos; - ofnNotify.pszFile = NULL; - hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); + if(uCode == CDN_INCLUDEITEM) + { + OFNOTIFYEXA ofnNotify; + ofnNotify.psf = fodInfos->Shell.FOIShellFolder; + ofnNotify.pidl = pidl; + ofnNotify.hdr.hwndFrom = hwndParentDlg; + ofnNotify.hdr.idFrom = 0; + ofnNotify.hdr.code = uCode; + ofnNotify.lpOFN = (LPOPENFILENAMEA)fodInfos->ofnInfos; + + TRACE("CALL NOTIFYEX for %x psf=%p pidl=%p\n", uCode,fodInfos->Shell.FOIShellFolder,pidl); + + hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); + } + else + { + OFNOTIFYA ofnNotify; + ofnNotify.pszFile = NULL; + ofnNotify.hdr.hwndFrom = hwndParentDlg; + ofnNotify.hdr.idFrom = 0; + ofnNotify.hdr.code = uCode; + ofnNotify.lpOFN = (LPOPENFILENAMEA)fodInfos->ofnInfos; + + TRACE("CALL NOTIFY for %x\n", uCode); + + hook_result = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); + } } - TRACE("RET NOTIFY\n"); } + TRACE("Retval: 0x%08lx\n", hook_result); return hook_result; } @@ -1008,9 +1047,9 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l FILEDLG95_ResizeControls(hwnd, wParam, lParam); FILEDLG95_FillControls(hwnd, wParam, lParam); - SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE); - SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE); - SendCustomDlgNotificationMessage(hwnd,CDN_SELCHANGE); + SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE,NULL); + SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE,NULL); + SendCustomDlgNotificationMessage(hwnd,CDN_SELCHANGE,NULL); return 0; } case WM_COMMAND: @@ -1597,7 +1636,7 @@ static BOOL FILEDLG95_SendFileOK( HWND hwnd, FileOpenDlgInfos *fodInfos ) TRACE("---\n"); /* First send CDN_FILEOK as MSDN doc says */ - retval = SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK); + retval = SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK,NULL); if (GetWindowLongPtrW(fodInfos->DlgInfos.hwndCustomDlg, DWLP_MSGRESULT)) { TRACE("canceled\n"); @@ -1994,7 +2033,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) { if (SUCCEEDED(IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE))) { - SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE); + SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE, NULL); } } else if( nOpenAction == ONOPEN_SEARCH ) @@ -2296,7 +2335,7 @@ static BOOL FILEDLG95_SHELL_UpFolder(HWND hwnd) NULL, SBSP_PARENT))) { - SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE); + SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE, NULL); return TRUE; } return FALSE; @@ -2318,7 +2357,7 @@ static BOOL FILEDLG95_SHELL_BrowseToDesktop(HWND hwnd) SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidl); hres = IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidl, SBSP_ABSOLUTE); - SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE); + SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE, NULL); COMDLG32_SHFree(pidl); return SUCCEEDED(hres); } @@ -2496,7 +2535,7 @@ static BOOL FILEDLG95_FILETYPE_OnCommand(HWND hwnd, WORD wNotifyCode) len = lstrlenW(lpstrFilter)+1; fodInfos->ShellInfos.lpstrCurrentFilter = MemAlloc( len * sizeof(WCHAR) ); lstrcpyW(fodInfos->ShellInfos.lpstrCurrentFilter,lpstrFilter); - SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE); + SendCustomDlgNotificationMessage(hwnd,CDN_TYPECHANGE,NULL); } /* Refresh the actual view to display the included items*/ @@ -2798,7 +2837,7 @@ static BOOL FILEDLG95_LOOKIN_OnCommand(HWND hwnd, WORD wNotifyCode) tmpFolder->pidlItem, SBSP_ABSOLUTE))) { - SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE); + SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE, NULL); return TRUE; } break; @@ -3472,7 +3511,7 @@ static BOOL BrowseSelectedFolder(HWND hwnd) MessageBoxW( hwnd, notexist, fodInfos->title, MB_OK | MB_ICONEXCLAMATION ); } bBrowseSelFolder = TRUE; - SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE); + SendCustomDlgNotificationMessage(hwnd,CDN_FOLDERCHANGE,NULL); } COMDLG32_SHFree( pidlSelection ); } diff --git a/dlls/comdlg32/filedlgbrowser.c b/dlls/comdlg32/filedlgbrowser.c index f933f15..bbea234 100644 --- a/dlls/comdlg32/filedlgbrowser.c +++ b/dlls/comdlg32/filedlgbrowser.c @@ -785,7 +785,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDl if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) ) { hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE); - SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE); + SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE, NULL); } else { @@ -875,6 +875,9 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBr if(ulAttr & (SFGAO_FOLDER | SFGAO_LINK)) return S_OK; + if(SendCustomDlgNotificationMessage(This->hwndOwner, CDN_INCLUDEITEM, (LPITEMIDLIST)pidl)) + return S_OK; + /* Check if there is a mask to apply if not */ if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter)) return S_OK; @@ -884,7 +887,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBr if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl))) { if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter)) - return S_OK; + return S_OK; } } return S_FALSE; @@ -914,7 +917,7 @@ static HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *if FILEDLG95_FILENAME_FillFromSelection(This->hwndOwner); - SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE); + SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE, NULL); return S_OK; } diff --git a/dlls/comdlg32/filedlgbrowser.h b/dlls/comdlg32/filedlgbrowser.h index f8da75e..2cfedc4 100644 --- a/dlls/comdlg32/filedlgbrowser.h +++ b/dlls/comdlg32/filedlgbrowser.h @@ -161,6 +161,6 @@ extern IShellFolder* GetShellFolderFromPidl(LPITEMIDLIST pidlAbs); extern LPITEMIDLIST GetParentPidl(LPITEMIDLIST pidl); extern int FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl); -extern LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode); +extern LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode,LPITEMIDLIST pidl); #endif /*SHBROWSER_H*/ diff --git a/include/commdlg.h b/include/commdlg.h index 914e4c8..b22dc90 100644 --- a/include/commdlg.h +++ b/include/commdlg.h @@ -147,6 +147,22 @@ typedef struct DECL_WINELIB_TYPE_AW(OFNOTIFY) DECL_WINELIB_TYPE_AW(LPOFNOTIFY) +typedef struct _OFNOTIFYEXA +{ + NMHDR hdr; + LPOPENFILENAMEA lpOFN; + LPVOID psf; + LPVOID pidl; +} OFNOTIFYEXA, *LPOFNOTIFYEXA; + +typedef struct _OFNOTIFYEXW +{ + NMHDR hdr; + LPOPENFILENAMEW lpOFN; + LPVOID psf; + LPVOID pidl; +} OFNOTIFYEXW, *LPOFNOTIFYEXW; + typedef UINT (CALLBACK *LPCCHOOKPROC) (HWND, UINT, WPARAM, LPARAM); typedef struct { @@ -412,7 +428,6 @@ static const WCHAR HELPMSGSTRINGW[] = { 'c','o','m','m','d','l','g','_', #endif #define HELPMSGSTRING WINELIB_NAME_AW(HELPMSGSTRING) - #define CD_LBSELNOITEMS -1 #define CD_LBSELCHANGE 0 #define CD_LBSELSUB 1 @@ -428,6 +443,7 @@ static const WCHAR HELPMSGSTRINGW[] = { 'c','o','m','m','d','l','g','_', #define CDN_HELP (CDN_FIRST - 0x0004) #define CDN_FILEOK (CDN_FIRST - 0x0005) #define CDN_TYPECHANGE (CDN_FIRST - 0x0006) +#define CDN_INCLUDEITEM (CDN_FIRST - 0x0007) #define CDM_FIRST (WM_USER + 100) #define CDM_LAST (WM_USER + 200) -- 1.5.6.3