📄 filedlgbrowser.c
字号:
*
* This function will override user specified flags and will always
* use SBSP_DEFBROWSER and SBSP_DEFMODE.
*/
static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
LPCITEMIDLIST pidl,
UINT wFlags)
{
HRESULT hRes;
IShellFolder *psfTmp;
IShellView *psvTmp;
FileOpenDlgInfos *fodInfos;
LPITEMIDLIST pidlTmp;
HWND hwndView;
HWND hDlgWnd;
BOOL bViewHasFocus;
RECT rectView;
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)(pidl=%p,flags=0x%08x)\n", This, pidl, wFlags);
COMDLG32_DumpSBSPFlags(wFlags);
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
/* Format the pidl according to its parameter's category */
if(wFlags & SBSP_RELATIVE)
{
/* SBSP_RELATIVE A relative pidl (relative from the current folder) */
if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp)))
{
ERR("bind to object failed\n");
return hRes;
}
/* create an absolute pidl */
pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
(LPCITEMIDLIST)pidl);
}
else if(wFlags & SBSP_PARENT)
{
/* Browse the parent folder (ignores the pidl) */
pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
psfTmp = GetShellFolderFromPidl(pidlTmp);
}
else /* SBSP_ABSOLUTE is 0x0000 */
{
/* An absolute pidl (relative from the desktop) */
pidlTmp = COMDLG32_PIDL_ILClone((LPCITEMIDLIST)pidl);
psfTmp = GetShellFolderFromPidl(pidlTmp);
}
if(!psfTmp)
{
ERR("could not browse to folder\n");
return E_FAIL;
}
/* If the pidl to browse to is equal to the actual pidl ...
do nothing and pretend you did it*/
if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
{
IShellFolder_Release(psfTmp);
COMDLG32_SHFree(pidlTmp);
TRACE("keep current folder\n");
return NOERROR;
}
/* Release the current DataObject */
if (fodInfos->Shell.FOIDataObject)
{
IDataObject_Release(fodInfos->Shell.FOIDataObject);
fodInfos->Shell.FOIDataObject = NULL;
}
/* Create the associated view */
TRACE("create view object\n");
if(FAILED(hRes = IShellFolder_CreateViewObject(psfTmp, fodInfos->ShellInfos.hwndOwner,
&IID_IShellView, (LPVOID *)&psvTmp))) goto error;
/* Check if listview has focus */
bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
/* Get the foldersettings from the old view */
if(fodInfos->Shell.FOIShellView)
IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, &fodInfos->ShellInfos.folderSettings);
/* Release the old fodInfos->Shell.FOIShellView and update its value.
We have to update this early since ShellView_CreateViewWindow of native
shell32 calls OnStateChange and needs the correct view here.*/
if(fodInfos->Shell.FOIShellView)
{
IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
IShellView_Release(fodInfos->Shell.FOIShellView);
}
fodInfos->Shell.FOIShellView = psvTmp;
/* Release old FOIShellFolder and update its value */
if (fodInfos->Shell.FOIShellFolder)
IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
fodInfos->Shell.FOIShellFolder = psfTmp;
/* Release old pidlAbsCurrent and update its value */
COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
COMDLG32_UpdateCurrentDir(fodInfos);
GetWindowRect(GetDlgItem(This->hwndOwner, IDC_SHELLSTATIC), &rectView);
MapWindowPoints(0, This->hwndOwner, (LPPOINT)&rectView, 2);
/* Create the window */
TRACE("create view window\n");
if(FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
&fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
&rectView, &hwndView))) goto error;
fodInfos->ShellInfos.hwndView = hwndView;
/* Set view window control id to 5002 */
SetWindowLongPtrW(hwndView, GWLP_ID, lst2);
/* Select the new folder in the Look In combo box of the Open file dialog */
FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
/* changes the tab order of the ListView to reflect the window's File Dialog */
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 hRes;
error:
ERR("Failed with error 0x%08x\n", hRes);
return hRes;
}
/**************************************************************************
* IShellBrowserImpl_EnableModelessSB
*/
static HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
BOOL fEnable)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)\n", This);
/* Feature not implemented */
return E_NOTIMPL;
}
/**************************************************************************
* IShellBrowserImpl_GetControlWindow
*/
static HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
UINT id,
HWND *lphwnd)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)\n", This);
/* Feature not implemented */
return E_NOTIMPL;
}
/**************************************************************************
* IShellBrowserImpl_GetViewStateStream
*/
static HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
DWORD grfMode,
LPSTREAM *ppStrm)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
FIXME("(%p 0x%08x %p)\n", This, grfMode, ppStrm);
/* Feature not implemented */
return E_NOTIMPL;
}
/**************************************************************************
* IShellBrowserImpl_InsertMenusSB
*/
static HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
HMENU hmenuShared,
LPOLEMENUGROUPWIDTHS lpMenuWidths)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)\n", This);
/* Feature not implemented */
return E_NOTIMPL;
}
/**************************************************************************
* IShellBrowserImpl_OnViewWindowActive
*/
static HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
IShellView *ppshv)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)\n", This);
/* Feature not implemented */
return E_NOTIMPL;
}
/**************************************************************************
* IShellBrowserImpl_QueryActiveShellView
*/
static HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
IShellView **ppshv)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
FileOpenDlgInfos *fodInfos;
TRACE("(%p)\n", This);
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
if(!(*ppshv = fodInfos->Shell.FOIShellView))
{
return E_FAIL;
}
IShellView_AddRef(fodInfos->Shell.FOIShellView);
return NOERROR;
}
/**************************************************************************
* IShellBrowserImpl_RemoveMenusSB
*/
static HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
HMENU hmenuShared)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)\n", This);
/* Feature not implemented */
return E_NOTIMPL;
}
/**************************************************************************
* IShellBrowserImpl_SendControlMsg
*/
static HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
UINT id,
UINT uMsg,
WPARAM wParam,
LPARAM lParam,
LRESULT *pret)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
LRESULT lres;
TRACE("(%p)->(0x%08x 0x%08x 0x%08lx 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
switch (id)
{
case FCW_TOOLBAR:
lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
break;
default:
FIXME("ctrl id: %x\n", id);
return E_NOTIMPL;
}
if (pret) *pret = lres;
return S_OK;
}
/**************************************************************************
* IShellBrowserImpl_SetMenuSB
*/
static HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
HMENU hmenuShared,
HOLEMENU holemenuReserved,
HWND hwndActiveObject)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)\n", This);
/* Feature not implemented */
return E_NOTIMPL;
}
/**************************************************************************
* IShellBrowserImpl_SetStatusTextSB
*/
static HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
LPCOLESTR lpszStatusText)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)\n", This);
/* Feature not implemented */
return E_NOTIMPL;
}
/**************************************************************************
* IShellBrowserImpl_SetToolbarItems
*/
static HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
LPTBBUTTON lpButtons,
UINT nButtons,
UINT uFlags)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)\n", This);
/* Feature not implemented */
return E_NOTIMPL;
}
/**************************************************************************
* IShellBrowserImpl_TranslateAcceleratorSB
*/
static HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
LPMSG lpmsg,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -