Exposing the IContextMenu in a different way :)
I did find a intressting shell32 API in the MSDN which not have been outed before in this forum. I tried it but I did get a very unexpected error. Maybe we can cooperate to make this work?
This API on success returns a pointer to IContextMenu interface.
Code:
Public Declare Function SHFind_InitMenuPopup Lib "shell32.dll" (ByVal hMenu As Long, ByVal hwndOwner As Long, ByVal iCmdFirst As Long, ByVal iCmdLast As Long) As Long
Public Sub GetIContextMenu(Optional ByVal hPopMenu As Long, Optional ByVal hwndOwner As Long)
Dim ppICM As Long
Dim pICM As IContextMenu
Dim hr As Long
If hPopMenu = 0 Then hPopMenu = CreatePopupMenu()
If hPopMenu <> 0 Then
ppICM = SHFind_InitMenuPopup(hPopMenu, hwndOwner, 1, &HFFFF)
If ppICM > 0 Then
MoveMemory pICM, ppICM, 4
pICM.QueryContextMenu hPopMenu, 0, 1, &HFFFF, CMF_EXPLORE Or CMF_CANRENAME '<-- This is giving me a unexpected error 445 - Object doesn't support this action.
End If
End If
End Sub
Re: Exposing the IContextMenu in a different way :)
Quote:
Retrieves the IContextMenu instance for the submenu of options displayed for the Search entry in the Classic style Start menu.
Classic style start menu doesn't exist on Windows 10 or 11.
Re: Exposing the IContextMenu in a different way :)
What a pitty :o
But If anyone will work on it, it will work for any Win prior to version 10.