CatchFish Posted November 29, 2005 Posted November 29, 2005 (edited) I need the handle of a context-menu created by GuiCtrlCreateContextMenu() for use in an API function (that is, TrackPopupMenu() of user32.dll). however, ControlGetHandle() returns null for the menu created. Is there any tricky way to do that? EDITED: implemented in v3.1.1.93 with GuiCtrlGetHandle() Edited December 11, 2005 by CatchFish
GaryFrost Posted November 29, 2005 Posted November 29, 2005 I need the handle of a context-menu created by GuiCtrlCreateContextMenu() for use in an API function (that is, TrackPopupMenu() of user32.dll). however, ControlGetHandle() returns null for the menu created. Is there any tricky way to do that? Not sure why you would need that, and why you would want to do the TrackPopMenu.Context Menu is handled the same as Menu's, buttons etc...for example $lv_services_contextmenu = GUICtrlCreateContextMenu($lv_services) $lv_service_stop = GUICtrlCreateMenuItem("Stop Service", $lv_services_contextmenu) $lv_service_start = GUICtrlCreateMenuItem("Start Service", $lv_services_contextmenu)and in the same select section as any buttons on the form Case $msg = $lv_service_stop _SetServiceState($lv_pcs, $lv_services, "Stop", $Status) Case $msg = $lv_service_start _SetServiceState($lv_pcs, $lv_services, "Start", $Status) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Holger Posted November 29, 2005 Posted November 29, 2005 (edited) At the moment there is no possibility. There is a developer discussion at the moment about this... Edited November 29, 2005 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
CatchFish Posted December 2, 2005 Author Posted December 2, 2005 Thanks, gafrost & Holger. I wanted to simulate a toolbar button with a pop-up menu. Maybe I shall just keep waiting?
Holger Posted December 3, 2005 Posted December 3, 2005 (edited) I completed it so far (GUICtrlGetHandle). Maybe it will be buildin in one of the next beta updates (let's hope the best) So you could create a contextmenu for a dummy control and then use this menu later for 'Trackking' it up. So long... Holger Edited December 3, 2005 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Zedna Posted December 3, 2005 Posted December 3, 2005 (edited) I completed it so far (GUICtrlGetHandle). Maybe it will be buildin in one of the next beta updates (let's hope the best) So you could create a contextmenu for a dummy control and then use this menu later for 'Trackking' it up. So long... Holger @Holger Hi Holger, please explain to me, what is diference between ControlGetHandle() and your new GUICtrlGetHandle() EDIT: I mean ControlGetHandle("","",control_id) In my example I have this code and it works fine: $treeview = GUICtrlCreateTreeView (6,6,200,160,...) $h_tree = ControlGetHandle("", "", $treeview) It's from my post about UDF _TreeViewGetItemState.au3 http://www.autoitscript.com/forum/index.php?showtopic=18409 EDIT2: I think it will be enough to mention explicitly in Hepfile at ControlGetHandle() posibility of getting handle also with GUI controls by ControlGetHandle("","",control_id) instead of adding new GUICtrlGetHandle(control_id) If I'm wrong please tell me the diference... Thank you @CatchFish Try ControlGetHandle() as in my example if it will work also with your popupmenu control... Edited December 3, 2005 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
CatchFish Posted December 11, 2005 Author Posted December 11, 2005 It's already implemented in v3.1.1.93 with GuiCtrlGetHandle(). Thanks a lot, Holger!
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