miss programmer
miss programmer

Reputation: 49

What makes it so that all OneDrive context menu items appear twice in my IContextMenu?

In my application, I'm showing an IContextMenu when a user right-clicks an item. Just like Windows Explorer. The problem is that all OneDrive items are added twice, some with slightly different names. The items in one list have a GUID as verb, the items in the second list don't have a verb, only an id, which is also different from the items in the first list. So it's not possible to filter on duplicate ids/verbs/text.

I've tried getting the IContextMenu using IShellFolder.GetUIObjectOf:

shellFolder.GetUIObjectOf(IntPtr.Zero, pidls.Length, pidls, GetType(IContextMenu).GUID, 0, ptrContextMenu)

And I've tried getting the IContextMenu using SHCreateDefaultContextMenu:

Dim dcm As New DEFCONTEXTMENU With {
    .psf = shellFolder,
    .pidlFolder = folderpidl,
    .cidl = pidls.Count,
    .apidl = pidlsPtr,
    .punkAssociationInfo = IntPtr.Zero,
    .cKeys = 0,
    .aKeys = IntPtr.Zero
}
Functions.SHCreateDefaultContextMenu(dcm, GetType(IContextMenu).GUID, ptrContextMenu)

Both rendering the same results:

enter image description here

Edit: this seems to be a Windows 11 problem. I tested with a clean install of Windows 10 Enterprise (without any additional software) and I didn't have the problem. Then I tested with a clean install of Windows 11 Enterprise and two of the OneDrive items were doubles:

enter image description here

As you can see, they even differ in which items are enabled. One difference between Windows 10 and Windows 11 is that with Windows 11 OneDrive comes pre-installed and with Windows 10 it doesn't and I still had to go and download it. Another difference is that Windows 11 now has IExplorerCommand - maybe that's got something to do with it?

Is anyone else seeing this with their software?

Upvotes: 2

Views: 81

Answers (0)

Related Questions