VAN0 Posted June 6, 2010 Share Posted June 6, 2010 Hello. 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. Link to comment Share on other sites More sharing options...
Yoriz Posted June 6, 2010 Share Posted June 6, 2010 Hey, here is an example of a context menu on a list and a listview. expandcollapse popup#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) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem1 _Msg("$MenuItem1") Case $MenuItem2 _Msg("$MenuItem2") Case $MenuItem3 _Msg("$MenuItem3") Case $MenuItem4 _Msg("$MenuItem4") EndSwitch WEnd 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. Link to comment Share on other sites More sharing options...
VAN0 Posted June 6, 2010 Author Share Posted June 6, 2010 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now