You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#1050 broke this at the same time as fixing #862. It changed both interfaces from InterfaceIsIDispatch to InterfaceIsDual, but IShellFolderViewDual currently only works as InterfaceIsIDispatch.
usingSystem;usingSystem.Runtime.InteropServices;usingWindows.Win32;usingWindows.Win32.UI.Shell;usingIServiceProvider=Windows.Win32.System.Com.IServiceProvider;varshellWindows=(IShellWindows)newShellWindows();varserviceProvider=(IServiceProvider)shellWindows.FindWindowSW(PInvoke.CSIDL_DESKTOP,pvarLocRoot:null,ShellWindowTypeConstants.SWC_DESKTOP,phwnd:out_,ShellWindowFindWindowOptions.SWFO_NEEDDISPATCH);serviceProvider.QueryService(PInvoke.SID_STopLevelBrowser,typeof(IShellBrowser).GUID,outvarshellBrowserAsObject);varshellBrowser=(IShellBrowser)shellBrowserAsObject;shellBrowser.QueryActiveShellView(outvarshellView);variid_IDispatch=newGuid("00020400-0000-0000-C000-000000000046");shellView.GetItemObject((uint)_SVGIO.SVGIO_BACKGROUND,iid_IDispatch,outvarfolderViewAsObject);varfolderView=(IShellFolderViewDual)folderViewAsObject;_=folderView.Application;// Throws InvalidOleVariantTypeException "Specified OLE variant is invalid"
Declare the same interface but with InterfaceIsIDispatch:
[Guid("E7A1AF80-4D96-11CF-960C-0080C7F4EE85"),InterfaceType(ComInterfaceType.InterfaceIsIDispatch),ComImport]interfaceIShellFolderViewDual{/// <summary>Gets the application object.</summary>/// <returns>/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.</para>/// </returns>/// <remarks>/// <para><see href="https://docs.microsoft.com/windows/win32/api//shldisp/nf-shldisp-ishellfolderviewdual-get_application">Learn more about this API from docs.microsoft.com</see>.</para>/// </remarks>objectApplication{get;}// Other members omitted }
The text was updated successfully, but these errors were encountered:
@reflectronic suggested something that worked, and opens up a new avenue to explore:
[Guid("E7A1AF80-4D96-11CF-960C-0080C7F4EE85"),InterfaceType(ComInterfaceType.InterfaceIsDual),ComImport]interfaceIShellFolderViewDual{/// <summary>Gets the application object.</summary>/// <returns>/// <para>Type: <b>HRESULT</b> If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.</para>/// </returns>/// <remarks>/// <para><see href="https://docs.microsoft.com/windows/win32/api//shldisp/nf-shldisp-ishellfolderviewdual-get_application">Learn more about this API from docs.microsoft.com</see>.</para>/// </remarks>objectApplication{[return:MarshalAs(UnmanagedType.IUnknown)]get;}// Other members omitted }
#1050 broke this at the same time as fixing #862. It changed both interfaces from
InterfaceIsIDispatch
toInterfaceIsDual
, butIShellFolderViewDual
currently only works asInterfaceIsIDispatch
.Repro
Workaround
Declare the same interface but with
InterfaceIsIDispatch
:The text was updated successfully, but these errors were encountered: