From d4dbd62070d1bfed2497ca1179aedd7d3a1a3ba4 Mon Sep 17 00:00:00 2001 From: Ricardo Filipe Date: Sun, 21 Dec 2008 07:02:20 +0000 Subject: comdlg32: implement CDN_INCLUDEITEM notification --- dlls/comdlg32/filedlg.c | 87 +++++++++++++++++++++++++++------------ dlls/comdlg32/filedlgbrowser.c | 9 +++- dlls/comdlg32/filedlgbrowser.h | 2 +- 3 files changed, 67 insertions(+), 31 deletions(-) diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index e1eedd1..c42cd5c 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,62 @@ LRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode) if(fodInfos->DlgInfos.hwndCustomDlg) { - TRACE("CALL NOTIFY for %x\n", uCode); + TRACE("CALL NOTIFY for %x pidl=%p\n", uCode, pidl); + 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; + + 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; + + 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; + + 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; + + 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 +1041,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 +1630,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 +2027,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 +2329,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 +2351,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 +2529,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 +2831,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 +3505,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..6eec3b5 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*/ -- 1.5.6.3