Jump to content
Sign in to follow this  

Is it possible display shell context menu in list?

Recommended Posts



I have a GUI list with 2 files in it. When I select one file and right click on it, I'd like to see the context menu as if I right click on that file in explorer window. Is this possible?

Thank you.

Share this post

Link to post
Share on other sites

Hey, here is an example of a context menu on a list and a listview.

#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("ContextMenu Test", 270, 130, -1, -1)
$List1 = GUICtrlCreateList("", 8, 16, 121, 97)
GUICtrlSetData(-1, "item1|item2")
$List1context = GUICtrlCreateContextMenu($List1)
$MenuItem1 = GUICtrlCreateMenuItem("MenuItem1", $List1context)
$MenuItem2 = GUICtrlCreateMenuItem("MenuItem2", $List1context)
$ListView1 = GUICtrlCreateListView("Col1|Col2", 136, 16, 122, 97)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
$ListView1_0 = GUICtrlCreateListViewItem("one|two", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("three|four", $ListView1)
$ListView1context = GUICtrlCreateContextMenu($ListView1)
$MenuItem3 = GUICtrlCreateMenuItem("MenuItem3", $ListView1context)
$MenuItem4 = GUICtrlCreateMenuItem("MenuItem4", $ListView1context)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $MenuItem1
        Case $MenuItem2
        Case $MenuItem3
        Case $MenuItem4


Func _Msg($sText)
    MsgBox(0, "Context Menu", $sText)
EndFunc   ;==>_Msg

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post

Link to post
Share on other sites

Thanks for the reply.

A simple context menu is not a problem, I'd like display the same context menu that is windows displays on folders or files.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this