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


Reply With Quote

