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
Call Shell32.IFolderView2.InvokeVerbOnSelection() with non-empty verb.
On such call nothing happens, no error is reported.
The issue is with current declaration of this method
/// <summary>Invokes the given verb on the current selection.</summary>/// <param name="pszVerb">/// <para>Type: <c>LPCSTR</c></para>/// <para>A pointer to a Unicode string containing a verb.</para>/// </param>/// <remarks>If pszVerb is <c>NULL</c>, then the default verb is invoked on the selection.</remarks>// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-ifolderview2-invokeverbonselection// HRESULT InvokeVerbOnSelection( LPCSTR pszVerb );voidInvokeVerbOnSelection([In,MarshalAs(UnmanagedType.LPWStr)]string?pszVerb);
As it said in comment, pszVerb should be LPCSTR, so proper marshalling should be MarshalAs(UnmanagedType.LPStr)] not UnmanagedType.LPWStr
With UnmanagedType.LPStr everything works as expected.
text in MSDN help is also misleading, stating that Unicode string is expected, while they clearly have it defined as ANSI string.
The text was updated successfully, but these errors were encountered:
Describe the bug and how to reproduce
Call Shell32.IFolderView2.InvokeVerbOnSelection() with non-empty verb.
On such call nothing happens, no error is reported.
The issue is with current declaration of this method
As it said in comment, pszVerb should be LPCSTR, so proper marshalling should be MarshalAs(UnmanagedType.LPStr)] not UnmanagedType.LPWStr
With UnmanagedType.LPStr everything works as expected.
text in MSDN help is also misleading, stating that Unicode string is expected, while they clearly have it defined as ANSI string.
The text was updated successfully, but these errors were encountered: