本文整理汇总了C++中IShellFolder_Release函数的典型用法代码示例。如果您正苦于以下问题:C++ IShellFolder_Release函数的具体用法?C++ IShellFolder_Release怎么用?C++ IShellFolder_Release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IShellFolder_Release函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_IShellFolderView
static void test_IShellFolderView(void)
{
IShellFolderView *folderview;
IShellFolder *desktop;
IShellView *view;
IDataObject *obj;
UINT i;
HRESULT hr;
hr = SHGetDesktopFolder(&desktop);
ok(hr == S_OK, "got (0x%08x)\n", hr);
hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
ok(hr == S_OK, "got (0x%08x)\n", hr);
hr = IShellView_QueryInterface(view, &IID_IShellFolderView, (void**)&folderview);
if (hr != S_OK)
{
win_skip("IShellView doesn't provide IShellFolderView on this platform\n");
IShellView_Release(view);
IShellFolder_Release(desktop);
return;
}
/* ::MoveIcons */
obj = IDataObjectImpl_Construct();
hr = IShellFolderView_MoveIcons(folderview, obj);
ok(hr == E_NOTIMPL || broken(hr == S_OK) /* W98 */, "got (0x%08x)\n", hr);
IDataObject_Release(obj);
/* ::SetRedraw without list created */
hr = IShellFolderView_SetRedraw(folderview, TRUE);
ok(hr == S_OK, "got (0x%08x)\n", hr);
/* ::QuerySupport */
hr = IShellFolderView_QuerySupport(folderview, NULL);
ok(hr == S_OK, "got (0x%08x)\n", hr);
i = 0xdeadbeef;
hr = IShellFolderView_QuerySupport(folderview, &i);
ok(hr == S_OK, "got (0x%08x)\n", hr);
ok(i == 0xdeadbeef, "got %d\n", i);
/* ::RemoveObject */
i = 0xdeadbeef;
hr = IShellFolderView_RemoveObject(folderview, NULL, &i);
ok(hr == S_OK, "got (0x%08x)\n", hr);
ok(i == 0 || i == -1 /* Win7 */ || broken(i == 0xdeadbeef) /* Vista, 2k8 */,
"got %d\n", i);
IShellFolderView_Release(folderview);
IShellView_Release(view);
IShellFolder_Release(desktop);
}
示例2: create_folder
static HRESULT create_folder(NewMenuImpl *This, IShellView *view)
{
IFolderView *folder_view = NULL;
IShellFolder *desktop = NULL;
IShellFolder *parent = NULL;
ISFHelper *helper = NULL;
LPITEMIDLIST pidl = NULL;
WCHAR nameW[MAX_PATH];
HRESULT hr;
if (view)
{
hr = IShellView_QueryInterface(view, &IID_IFolderView, (void **)&folder_view);
if (FAILED(hr)) return hr;
hr = IFolderView_GetFolder(folder_view, &IID_IShellFolder, (void **)&parent);
if (FAILED(hr)) goto out;
}
else
{
hr = SHGetDesktopFolder(&desktop);
if (FAILED(hr)) goto out;
hr = IShellFolder_BindToObject(desktop, This->pidl, NULL, &IID_IShellFolder, (void **)&parent);
if (FAILED(hr)) goto out;
}
IShellFolder_QueryInterface(parent, &IID_ISFHelper, (void **)&helper);
if (FAILED(hr)) goto out;
hr = ISFHelper_GetUniqueName(helper, nameW, MAX_PATH);
if (FAILED(hr)) goto out;
hr = ISFHelper_AddFolder(helper, 0, nameW, &pidl);
if (FAILED(hr)) goto out;
if (view)
{
IShellView_SelectItem(view, pidl, SVSI_DESELECTOTHERS | SVSI_EDIT |
SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT);
}
out:
if (pidl) SHFree(pidl);
if (helper) ISFHelper_Release(helper);
if (parent) IShellFolder_Release(parent);
if (desktop) IShellFolder_Release(desktop);
if (folder_view) IFolderView_Release(folder_view);
return hr;
}
示例3: test_IOleWindow
static void test_IOleWindow(void)
{
IShellFolder *desktop;
IShellView *view;
IOleWindow *wnd;
HRESULT hr;
hr = SHGetDesktopFolder(&desktop);
ok(hr == S_OK, "got (0x%08x)\n", hr);
hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
ok(hr == S_OK, "got (0x%08x)\n", hr);
hr = IShellView_QueryInterface(view, &IID_IOleWindow, (void**)&wnd);
ok(hr == E_NOINTERFACE, "got (0x%08x)\n", hr);
/* IShellView::ContextSensitiveHelp */
hr = IShellView_ContextSensitiveHelp(view, TRUE);
ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
hr = IShellView_ContextSensitiveHelp(view, FALSE);
ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
IShellView_Release(view);
IShellFolder_Release(desktop);
}
示例4: get_starting_shell_folder
static IShellFolder* get_starting_shell_folder(parameters_struct* params)
{
IShellFolder* desktop,*folder;
LPITEMIDLIST root_pidl;
HRESULT hres;
SHGetDesktopFolder(&desktop);
if (!params->root[0])
{
return desktop;
}
hres = IShellFolder_ParseDisplayName(desktop,NULL,NULL,
params->root,NULL,
&root_pidl,NULL);
if(FAILED(hres))
{
return desktop;
}
hres = IShellFolder_BindToObject(desktop,root_pidl,NULL,
&IID_IShellFolder,
(void**)&folder);
if(FAILED(hres))
{
return desktop;
}
IShellFolder_Release(desktop);
return folder;
}
示例5: ShellItem_get_parent_shellfolder
static HRESULT ShellItem_get_parent_shellfolder(ShellItem *This, IShellFolder **ppsf)
{
LPITEMIDLIST parent_pidl;
IShellFolder *desktop;
HRESULT ret;
ret = ShellItem_get_parent_pidl(This, &parent_pidl);
if (SUCCEEDED(ret))
{
ret = SHGetDesktopFolder(&desktop);
if (SUCCEEDED(ret))
{
if (_ILIsDesktop(parent_pidl))
{
*ppsf = desktop;
}
else
{
ret = IShellFolder_BindToObject(desktop, parent_pidl, NULL, &IID_IShellFolder, (void**)ppsf);
IShellFolder_Release(desktop);
}
}
ILFree(parent_pidl);
}
return ret;
}
示例6: test_parse_for_control_panel
/* Tests for Control Panel */
static void test_parse_for_control_panel(void)
{
/* path of My Computer\Control Panel */
static WCHAR control_panel_path[] = {
':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}','\\',
':',':','{','2','1','E','C','2','0','2','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','D','-','0','8','0','0','2','B','3','0','3','0','9','D','}', 0 };
IShellFolder *psfDesktop;
HRESULT hr;
DWORD eaten = 0xdeadbeef;
LPITEMIDLIST pidl;
DWORD attr = ~0;
hr = SHGetDesktopFolder(&psfDesktop);
ok(hr == S_OK, "SHGetDesktopFolder failed with error 0x%x\n", hr);
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, control_panel_path, &eaten, &pidl, &attr);
ok(hr == S_OK, "IShellFolder_ParseDisplayName failed with error 0x%x\n", hr);
todo_wine ok(eaten == 0xdeadbeef, "eaten should not have been set to %u\n", eaten);
todo_wine
ok((attr == (SFGAO_CANLINK | SFGAO_FOLDER)) || /* Win9x, NT4 */
(attr == (SFGAO_CANLINK | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_STREAM)) || /* W2K */
(attr == (SFGAO_CANLINK | SFGAO_FOLDER | SFGAO_HASSUBFOLDER)) || /* W2K, XP, W2K3 */
(attr == (SFGAO_CANLINK | SFGAO_NONENUMERATED)) || /* Vista */
(attr == SFGAO_CANLINK), /* Vista, W2K8 */
"Unexpected attributes : %08x\n", attr);
ILFree(pidl);
IShellFolder_Release(psfDesktop);
}
示例7: ShellItem_GetAttributes
static HRESULT WINAPI ShellItem_GetAttributes(IShellItem2 *iface, SFGAOF sfgaoMask,
SFGAOF *psfgaoAttribs)
{
ShellItem *This = impl_from_IShellItem2(iface);
IShellFolder *parent_folder;
LPITEMIDLIST child_pidl;
HRESULT ret;
TRACE("(%p,%x,%p)\n", iface, sfgaoMask, psfgaoAttribs);
if (_ILIsDesktop(This->pidl))
ret = SHGetDesktopFolder(&parent_folder);
else
ret = ShellItem_get_parent_shellfolder(This, &parent_folder);
if (SUCCEEDED(ret))
{
child_pidl = ILFindLastID(This->pidl);
*psfgaoAttribs = sfgaoMask;
ret = IShellFolder_GetAttributesOf(parent_folder, 1, (LPCITEMIDLIST*)&child_pidl, psfgaoAttribs);
*psfgaoAttribs &= sfgaoMask;
IShellFolder_Release(parent_folder);
if (SUCCEEDED(ret))
{
if(sfgaoMask == *psfgaoAttribs)
return S_OK;
else
return S_FALSE;
}
}
return ret;
}
示例8: BrsFolder_Treeview_Expand
static LRESULT BrsFolder_Treeview_Expand( browse_info *info, NMTREEVIEWW *pnmtv )
{
IShellFolder *lpsf2 = NULL;
LPTV_ITEMDATA lptvid = (LPTV_ITEMDATA) pnmtv->itemNew.lParam;
HRESULT r;
TRACE("TVN_ITEMEXPANDINGA/W\n");
if ((pnmtv->itemNew.state & TVIS_EXPANDEDONCE))
return 0;
if (!_ILIsEmpty(lptvid->lpi)) {
r = IShellFolder_BindToObject( lptvid->lpsfParent, lptvid->lpi, 0,
&IID_IShellFolder, (void**)&lpsf2 );
} else {
lpsf2 = lptvid->lpsfParent;
IShellFolder_AddRef(lpsf2);
r = S_OK;
}
if (SUCCEEDED(r))
{
FillTreeView( info, lpsf2, lptvid->lpifq, pnmtv->itemNew.hItem, lptvid->pEnumIL);
IShellFolder_Release( lpsf2 );
}
/* My Computer is already sorted and trying to do a simple text
* sort will only mess things up */
if (!_ILIsMyComputer(lptvid->lpi))
SendMessageW( info->hwndTreeView, TVM_SORTCHILDREN,
FALSE, (LPARAM)pnmtv->itemNew.hItem );
return 0;
}
示例9: pidl_to_shellfolder
static HRESULT pidl_to_shellfolder(LPITEMIDLIST pidl, LPWSTR *displayname, IShellFolder **out_folder)
{
IShellFolder* parent_folder=NULL;
LPCITEMIDLIST relative_pidl=NULL;
STRRET strret;
HRESULT hr;
hr = SHBindToParent(pidl, &IID_IShellFolder, (void**)&parent_folder, &relative_pidl);
if (displayname)
{
if (SUCCEEDED(hr))
hr = IShellFolder_GetDisplayNameOf(parent_folder, relative_pidl, SHGDN_INFOLDER, &strret);
if (SUCCEEDED(hr))
hr = StrRetToStrW(&strret, NULL, displayname);
}
if (SUCCEEDED(hr))
hr = IShellFolder_BindToObject(parent_folder, relative_pidl, NULL, &IID_IShellFolder, (void**)out_folder);
if (parent_folder)
IShellFolder_Release(parent_folder);
return hr;
}
示例10: update_shell_folder_listview
static void update_shell_folder_listview(HWND dialog) {
int i;
LVITEMW item;
LONG lSelected = SendDlgItemMessageW(dialog, IDC_LIST_SFPATHS, LVM_GETNEXTITEM, -1,
MAKELPARAM(LVNI_SELECTED,0));
SendDlgItemMessageW(dialog, IDC_LIST_SFPATHS, LVM_DELETEALLITEMS, 0, 0);
for (i=0; i<NUM_ELEMS(asfiInfo); i++) {
WCHAR buffer[MAX_PATH];
HRESULT hr;
LPITEMIDLIST pidlCurrent;
/* Some acrobatic to get the localized name of the shell folder */
hr = SHGetFolderLocation(dialog, asfiInfo[i].nFolder, NULL, 0, &pidlCurrent);
if (SUCCEEDED(hr)) {
LPSHELLFOLDER psfParent;
LPCITEMIDLIST pidlLast;
hr = SHBindToParent(pidlCurrent, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
if (SUCCEEDED(hr)) {
STRRET strRet;
hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_FORADDRESSBAR, &strRet);
if (SUCCEEDED(hr)) {
hr = StrRetToBufW(&strRet, pidlLast, buffer, MAX_PATH);
}
IShellFolder_Release(psfParent);
}
ILFree(pidlCurrent);
}
/* If there's a dangling symlink for the current shell folder, SHGetFolderLocation
* will fail above. We fall back to the (non-verified) path of the shell folder. */
if (FAILED(hr)) {
hr = SHGetFolderPathW(dialog, asfiInfo[i].nFolder|CSIDL_FLAG_DONT_VERIFY, NULL,
SHGFP_TYPE_CURRENT, buffer);
}
item.mask = LVIF_TEXT | LVIF_PARAM;
item.iItem = i;
item.iSubItem = 0;
item.pszText = buffer;
item.lParam = (LPARAM)&asfiInfo[i];
SendDlgItemMessageW(dialog, IDC_LIST_SFPATHS, LVM_INSERTITEMW, 0, (LPARAM)&item);
item.mask = LVIF_TEXT;
item.iItem = i;
item.iSubItem = 1;
item.pszText = strdupU2W(asfiInfo[i].szLinkTarget);
SendDlgItemMessageW(dialog, IDC_LIST_SFPATHS, LVM_SETITEMW, 0, (LPARAM)&item);
HeapFree(GetProcessHeap(), 0, item.pszText);
}
/* Ensure that the previously selected item is selected again. */
if (lSelected >= 0) {
item.mask = LVIF_STATE;
item.state = LVIS_SELECTED;
item.stateMask = LVIS_SELECTED;
SendDlgItemMessageW(dialog, IDC_LIST_SFPATHS, LVM_SETITEMSTATE, lSelected, (LPARAM)&item);
}
}
示例11: ISvItemCm_fnRelease
/**************************************************************************
* ISvItemCm_fnRelease
*/
static ULONG WINAPI ISvItemCm_fnRelease(IContextMenu *iface)
{
ICOM_THIS(ItemCmImpl, iface);
TRACE("(%p)->()\n",This);
shell32_ObjCount--;
if (!--(This->ref))
{
TRACE(" destroying IContextMenu(%p)\n",This);
if(This->pSFParent)
IShellFolder_Release(This->pSFParent);
if(This->pidl)
SHFree(This->pidl);
/*make sure the pidl is freed*/
_ILFreeaPidl(This->apidl, This->cidl);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
}
示例12: SHELL32_ParseNextElement
HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc,
LPITEMIDLIST * pidlInOut, LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes)
{
LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL;
IShellFolder *psfChild;
HRESULT hr;
TRACE ("(%p, %p, %p, %s)\n", psf, pbc, pidlInOut ? *pidlInOut : NULL, debugstr_w (szNext));
/* get the shellfolder for the child pidl and let it analyse further */
hr = IShellFolder2_BindToObject (psf, *pidlInOut, pbc, &IID_IShellFolder, (LPVOID *) & psfChild);
if (SUCCEEDED(hr)) {
hr = IShellFolder_ParseDisplayName (psfChild, hwndOwner, pbc, szNext, pEaten, &pidlOut, pdwAttributes);
IShellFolder_Release (psfChild);
if (SUCCEEDED(hr)) {
pidlTemp = ILCombine (*pidlInOut, pidlOut);
if (!pidlTemp)
hr = E_OUTOFMEMORY;
}
if (pidlOut)
ILFree (pidlOut);
}
ILFree (*pidlInOut);
*pidlInOut = pidlTemp;
TRACE ("-- pidl=%p ret=0x%08x\n", pidlInOut ? *pidlInOut : NULL, hr);
return hr;
}
示例13: test_parse_for_entire_network
/* Tests for My Network Places */
static void test_parse_for_entire_network(void)
{
static WCHAR my_network_places_path[] = {
':',':','{','2','0','8','D','2','C','6','0','-','3','A','E','A','-',
'1','0','6','9','-','A','2','D','7','-','0','8','0','0','2','B','3','0','3','0','9','D','}', 0 };
static WCHAR entire_network_path[] = {
':',':','{','2','0','8','D','2','C','6','0','-','3','A','E','A','-',
'1','0','6','9','-','A','2','D','7','-','0','8','0','0','2','B','3','0','3','0','9','D',
'}','\\','E','n','t','i','r','e','N','e','t','w','o','r','k',0 };
IShellFolder *psfDesktop;
HRESULT hr;
DWORD eaten = 0xdeadbeef;
LPITEMIDLIST pidl;
DWORD attr = ~0;
DWORD expected_attr;
hr = SHGetDesktopFolder(&psfDesktop);
ok(hr == S_OK, "SHGetDesktopFolder failed with error 0x%x\n", hr);
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, my_network_places_path, &eaten, &pidl, &attr);
ok(hr == S_OK, "IShellFolder_ParseDisplayName failed with error 0x%x\n", hr);
todo_wine
ok(eaten == 0xdeadbeef, "eaten should not have been set to %u\n", eaten);
expected_attr = SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME|SFGAO_CANLINK;
todo_wine
ok((attr == expected_attr) || /* Win9x, NT4 */
(attr == (expected_attr | SFGAO_STREAM)) || /* W2K */
(attr == (expected_attr | SFGAO_CANDELETE)) || /* XP, W2K3 */
(attr == (expected_attr | SFGAO_CANDELETE | SFGAO_NONENUMERATED)), /* Vista */
"Unexpected attributes : %08x\n", attr);
ILFree(pidl);
/* Start clean again */
eaten = 0xdeadbeef;
attr = ~0;
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, entire_network_path, &eaten, &pidl, &attr);
IShellFolder_Release(psfDesktop);
if (hr == HRESULT_FROM_WIN32(ERROR_BAD_NET_NAME) ||
hr == HRESULT_FROM_WIN32(ERROR_NO_NET_OR_BAD_PATH) ||
hr == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER))
{
win_skip("'EntireNetwork' is not available on Win9x, NT4 and Vista\n");
return;
}
ok(hr == S_OK, "IShellFolder_ParseDisplayName failed with error 0x%x\n", hr);
todo_wine
ok(eaten == 0xdeadbeef, "eaten should not have been set to %u\n", eaten);
expected_attr = SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
todo_wine
ok(attr == expected_attr || /* winme, nt4 */
attr == (expected_attr | SFGAO_STREAM) || /* win2k */
attr == (expected_attr | SFGAO_STORAGEANCESTOR), /* others */
"attr should be 0x%x, not 0x%x\n", expected_attr, attr);
ILFree(pidl);
}
示例14: ShellItem_BindToHandler
static HRESULT WINAPI ShellItem_BindToHandler(IShellItem2 *iface, IBindCtx *pbc,
REFGUID rbhid, REFIID riid, void **ppvOut)
{
ShellItem *This = impl_from_IShellItem2(iface);
HRESULT ret;
TRACE("(%p,%p,%s,%p,%p)\n", iface, pbc, shdebugstr_guid(rbhid), riid, ppvOut);
*ppvOut = NULL;
if (IsEqualGUID(rbhid, &BHID_SFObject))
{
IShellFolder *psf;
ret = ShellItem_get_shellfolder(This, pbc, &psf);
if (SUCCEEDED(ret))
{
ret = IShellFolder_QueryInterface(psf, riid, ppvOut);
IShellFolder_Release(psf);
}
return ret;
}
else if (IsEqualGUID(rbhid, &BHID_SFUIObject))
{
IShellFolder *psf_parent;
if (_ILIsDesktop(This->pidl))
ret = SHGetDesktopFolder(&psf_parent);
else
ret = ShellItem_get_parent_shellfolder(This, &psf_parent);
if (SUCCEEDED(ret))
{
LPCITEMIDLIST pidl = ILFindLastID(This->pidl);
ret = IShellFolder_GetUIObjectOf(psf_parent, NULL, 1, &pidl, riid, NULL, ppvOut);
IShellFolder_Release(psf_parent);
}
return ret;
}
else if (IsEqualGUID(rbhid, &BHID_DataObject))
{
return ShellItem_BindToHandler(&This->IShellItem2_iface, pbc, &BHID_SFUIObject,
&IID_IDataObject, ppvOut);
}
FIXME("Unsupported BHID %s.\n", debugstr_guid(rbhid));
return MK_E_NOOBJECT;
}
示例15: test_selection
static void test_selection(void)
{
HRESULT resCoInit, hr;
BROWSEINFOA bi;
LPITEMIDLIST pidl = NULL;
IShellFolder *desktop_object;
WCHAR selected_folderW[MAX_PATH];
const CHAR title[] = "test_selection";
resCoInit = CoInitialize(NULL);
if(!(resCoInit == S_OK || resCoInit == S_FALSE))
{
skip("COM could not be initialized %u\n", GetLastError());
return;
}
if (!GetCurrentDirectoryW(MAX_PATH, selected_folderW))
{
skip("GetCurrentDirectoryW failed %u\n", GetLastError());
}
/* Initialize browse info struct for SHBrowseForFolder */
bi.hwndOwner = NULL;
bi.pszDisplayName = NULL;
bi.lpszTitle = title;
bi.lpfn = selection_callback;
hr = SHGetDesktopFolder(&desktop_object);
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed with hr 0x%08x\n", hr);
if (FAILED(hr)) {
skip("SHGetDesktopFolder failed - skipping\n");
return;
}
desktop_object->lpVtbl->ParseDisplayName(desktop_object, NULL, NULL,
selected_folderW, 0UL, &selected_folder_pidl, 0UL);
bi.pidlRoot = selected_folder_pidl;
/* test without flags */
bi.ulFlags = 0;
pidl = SHBrowseForFolderA(&bi);
if (pidl)
CoTaskMemFree(pidl);
/* test with flag */
bi.ulFlags = BIF_NEWDIALOGSTYLE;
pidl = SHBrowseForFolderA(&bi);
if (pidl)
CoTaskMemFree(pidl);
IShellFolder_Release(desktop_object);
CoUninitialize();
}