dom3787 Posted October 27, 2013 Share Posted October 27, 2013 (edited) Hi, I can drag & drop my gui with left click, but it won't work with right click, any idea why ? $hGUI = GUICreate('', 800, 600, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") GUIRegisterMsg($WM_RBUTTONDOWN, "_WM_RBUTTONDOWN") Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) Local Const $SC_DRAGMOVE = 0xF012 _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc Func _WM_RBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) Local Const $SC_DRAGMOVE = 0xF012 _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc I tried commenting the left button part but it still won't work with right button. Thanks for any infos. Edited October 27, 2013 by dom3787 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 27, 2013 Moderators Share Posted October 27, 2013 dom3787,If you test the code you see that the script is blocked within the "DRAGMOVE" section while the left button is pressed - while it returns instantly when called by the right button: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> Global Const $SC_DRAGMOVE = 0xF012 HotKeySet("{ESC}", "On_Exit") $hGUI = GUICreate('', 800, 600, -1, -1, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUISetBkColor(0xFF0000) GUISetState() GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") GUIRegisterMsg($WM_RBUTTONDOWN, "_WM_RBUTTONDOWN") While 1 Sleep(10) WEnd Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite("Left pressed at: " & @MSEC & @CRLF) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ConsoleWrite("Left released at: " & @MSEC & @CRLF) EndFunc Func _WM_RBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite("Right pressed at: " & @MSEC & @CRLF) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ConsoleWrite("Right released at: " & @MSEC & @CRLF) EndFunc Func On_Exit() Exit EndFuncThus it appears that you cannot use the right button to drag GUIs using this method - just as you cannot use the right button to drag normal GUIs. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dom3787 Posted October 27, 2013 Author Share Posted October 27, 2013 (edited) Now that's interesting, but as you said "using this method". Correct me if I'm wrong but I'm pretty sure I've already came across softwares where you could actually drag & drop things using the right button, so there might be a way to do it. Apparently not this one. (I guess I'm left to use mouseevent handler and move things *while the button is pressed*) Edited October 27, 2013 by dom3787 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 27, 2013 Moderators Share Posted October 27, 2013 dom3787,Looking at the 4 methods I describe in the Moving and Resizing PopUp GUIs tutorial in the Wiki, I would be surprised if any of them worked with the right button. Windows uses the 2 buttons to do different things (left to action, right to bring up context menus) and I feel you are asking too much to expect them to act in a similar manner just for you. Someone here might well know how to do what you want - but I do not believe it will be a simple solution and I am not holding my breath waiting for it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dom3787 Posted October 27, 2013 Author Share Posted October 27, 2013 (edited) Probably uneasy but doable for sure. With years I realised that speaking of computer science, about anything is possible. Only the time you want to invest in finding the answer matters. Anyway, thanks for this wiki page*, even if it's not working for the right button it definitely will improve my knowledge on the dragging topic ! edit : Resizing a $WS_POPUP GUI that script demonstrates what it has to do but fails in a way, to crash it, start the script, click with your cursor in another window or the desktop, move your cursor on your red GUI square > crash. Edited October 27, 2013 by dom3787 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