📄 filedlgbrowser.c
字号:
WORD wID)
{
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
TRACE("(%p)\n", This);
/* Feature not implemented */
return E_NOTIMPL;
}
static const IShellBrowserVtbl IShellBrowserImpl_Vtbl =
{
/* IUnknown */
IShellBrowserImpl_QueryInterface,
IShellBrowserImpl_AddRef,
IShellBrowserImpl_Release,
/* IOleWindow */
IShellBrowserImpl_GetWindow,
IShellBrowserImpl_ContextSensitiveHelp,
/* IShellBrowser */
IShellBrowserImpl_InsertMenusSB,
IShellBrowserImpl_SetMenuSB,
IShellBrowserImpl_RemoveMenusSB,
IShellBrowserImpl_SetStatusTextSB,
IShellBrowserImpl_EnableModelessSB,
IShellBrowserImpl_TranslateAcceleratorSB,
IShellBrowserImpl_BrowseObject,
IShellBrowserImpl_GetViewStateStream,
IShellBrowserImpl_GetControlWindow,
IShellBrowserImpl_SendControlMsg,
IShellBrowserImpl_QueryActiveShellView,
IShellBrowserImpl_OnViewWindowActive,
IShellBrowserImpl_SetToolbarItems
};
/*
* ICommDlgBrowser
*/
/***************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_QueryInterface
*/
static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
ICommDlgBrowser *iface,
REFIID riid,
LPVOID *ppvObj)
{
IShellBrowserImpl *This = impl_from_ICommDlgBrowser(iface);
TRACE("(%p)\n", This);
return IShellBrowserImpl_QueryInterface((IShellBrowser *)This,riid,ppvObj);
}
/**************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_AddRef
*/
static ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser * iface)
{
IShellBrowserImpl *This = impl_from_ICommDlgBrowser(iface);
TRACE("(%p)\n", This);
return IShellBrowserImpl_AddRef((IShellBrowser *)This);
}
/**************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_Release
*/
static ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser * iface)
{
IShellBrowserImpl *This = impl_from_ICommDlgBrowser(iface);
TRACE("(%p)\n", This);
return IShellBrowserImpl_Release((IShellBrowser *)This);
}
/**************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand
*
* Called when a user double-clicks in the view or presses the ENTER key
*/
static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser *iface,
IShellView *ppshv)
{
LPITEMIDLIST pidl;
FileOpenDlgInfos *fodInfos;
IShellBrowserImpl *This = impl_from_ICommDlgBrowser(iface);
TRACE("(%p)\n", This);
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
/* If the selected object is not a folder, send an IDOK command to parent window */
if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1)))
{
HRESULT hRes;
ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, (LPCITEMIDLIST *)&pidl, &ulAttr);
if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
{
hRes = IShellBrowser_BrowseObject((IShellBrowser *)This,pidl,SBSP_RELATIVE);
SendCustomDlgNotificationMessage(This->hwndOwner, CDN_FOLDERCHANGE);
}
else
{
/* Tell the dialog that the user selected a file */
PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
hRes = S_OK;
}
/* Free memory used by pidl */
COMDLG32_SHFree((LPVOID)pidl);
return hRes;
}
return E_FAIL;
}
/**************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_OnStateChange
*/
static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *iface,
IShellView *ppshv,
ULONG uChange)
{
IShellBrowserImpl *This = impl_from_ICommDlgBrowser(iface);
TRACE("(%p shv=%p)\n", This, ppshv);
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:
{
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
{
WCHAR szSave[16];
LoadStringW(COMDLG32_hInstance, IDS_SAVE_BUTTON, szSave, sizeof(szSave)/sizeof(WCHAR));
SetDlgItemTextW(fodInfos->ShellInfos.hwndOwner, IDOK, szSave);
}
}
break;
case CDBOSC_SELCHANGE:
return IShellBrowserImpl_ICommDlgBrowser_OnSelChange(iface,ppshv);
case CDBOSC_RENAME:
/* nothing to do */
break;
}
return NOERROR;
}
/**************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_IncludeObject
*/
static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
IShellView * ppshv,
LPCITEMIDLIST pidl)
{
FileOpenDlgInfos *fodInfos;
ULONG ulAttr;
STRRET str;
WCHAR szPathW[MAX_PATH];
IShellBrowserImpl *This = impl_from_ICommDlgBrowser(iface);
TRACE("(%p)\n", This);
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
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 */
return S_FALSE;
/* always include directories 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))
return S_OK;
if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str)))
{
if (SUCCEEDED(COMDLG32_StrRetToStrNW(szPathW, MAX_PATH, &str, pidl)))
{
if (PathMatchSpecW(szPathW, fodInfos->ShellInfos.lpstrCurrentFilter))
return S_OK;
}
}
return S_FALSE;
}
/**************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_OnSelChange
*/
static HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, const IShellView *ppshv)
{
FileOpenDlgInfos *fodInfos;
IShellBrowserImpl *This = impl_from_ICommDlgBrowser(iface);
fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
TRACE("(%p do=%p view=%p)\n", This, fodInfos->Shell.FOIDataObject, fodInfos->Shell.FOIShellView);
/* release old selections */
if (fodInfos->Shell.FOIDataObject)
IDataObject_Release(fodInfos->Shell.FOIDataObject);
/* 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);
SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
return S_OK;
}
static const ICommDlgBrowserVtbl IShellBrowserImpl_ICommDlgBrowser_Vtbl =
{
/* IUnknown */
IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
IShellBrowserImpl_ICommDlgBrowser_AddRef,
IShellBrowserImpl_ICommDlgBrowser_Release,
/* ICommDlgBrowser */
IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand,
IShellBrowserImpl_ICommDlgBrowser_OnStateChange,
IShellBrowserImpl_ICommDlgBrowser_IncludeObject
};
/*
* IServiceProvider
*/
/***************************************************************************
* IShellBrowserImpl_IServiceProvider_QueryInterface
*/
static HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface(
IServiceProvider *iface,
REFIID riid,
LPVOID *ppvObj)
{
IShellBrowserImpl *This = impl_from_IServiceProvider(iface);
FIXME("(%p)\n", This);
return IShellBrowserImpl_QueryInterface((IShellBrowser *)This,riid,ppvObj);
}
/**************************************************************************
* IShellBrowserImpl_IServiceProvider_AddRef
*/
static ULONG WINAPI IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider * iface)
{
IShellBrowserImpl *This = impl_from_IServiceProvider(iface);
FIXME("(%p)\n", This);
return IShellBrowserImpl_AddRef((IShellBrowser *)This);
}
/**************************************************************************
* IShellBrowserImpl_IServiceProvider_Release
*/
static ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider * iface)
{
IShellBrowserImpl *This = impl_from_IServiceProvider(iface);
FIXME("(%p)\n", This);
return IShellBrowserImpl_Release((IShellBrowser *)This);
}
/**************************************************************************
* IShellBrowserImpl_IServiceProvider_Release
*
* NOTES
* the w2k shellview asks for (guidService = SID_STopLevelBrowser,
* riid = IShellBrowser) to call SendControlMsg ().
*
* FIXME
* this is a hack!
*/
static HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService(
IServiceProvider * iface,
REFGUID guidService,
REFIID riid,
void** ppv)
{
IShellBrowserImpl *This = impl_from_IServiceProvider(iface);
FIXME("(%p)\n\t%s\n\t%s\n", This,debugstr_guid(guidService), debugstr_guid(riid) );
*ppv = NULL;
if(guidService && IsEqualIID(guidService, &SID_STopLevelBrowser))
{
return IShellBrowserImpl_QueryInterface((IShellBrowser *)This,riid,ppv);
}
FIXME("(%p) unknown interface requested\n", This);
return E_NOINTERFACE;
}
static const IServiceProviderVtbl IShellBrowserImpl_IServiceProvider_Vtbl =
{
/* IUnknown */
IShellBrowserImpl_IServiceProvider_QueryInterface,
IShellBrowserImpl_IServiceProvider_AddRef,
IShellBrowserImpl_IServiceProvider_Release,
/* IServiceProvider */
IShellBrowserImpl_IServiceProvider_QueryService
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -