Madza91 Posted January 27, 2009 Share Posted January 27, 2009 (edited) Hello!I best way to detect when is middle mouse pushed...I know for Mouse Hook without any external dll files, but it is bugged, and I posted that bug on this topic......Now, how I can detect middle mouse without any external dll files, and without any bags? Edited January 29, 2009 by n3nE [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
KaFu Posted January 27, 2009 Share Posted January 27, 2009 Clicking might work with: #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("04", $dll) Then MsgBox(0,"_IsPressed", "End Key Pressed") ExitLoop EndIf WEnd DllClose($dll) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Madza91 Posted January 27, 2009 Author Share Posted January 27, 2009 I know for that... It is very slow way... Because i have in While many things, and that is not very smart... Better will be over some notify func... [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
KaFu Posted January 27, 2009 Share Posted January 27, 2009 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StructureConstants.au3> Global Const $WM_MBUTTONDOWN = 0x0207 Local $msg GUICreate("My GUI"); will create a dialog box that when displayed is centered GUISetState(@SW_SHOW); will display an empty dialog box GUIRegisterMsg($WM_MBUTTONDOWN, "MY_WM_MBUTTONDOWN") ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func MY_WM_MBUTTONDOWN($hWnd, $iMsg, $iwParam, $ilParam) ConsoleWrite('Click') EndFunc ;==>MY_WM_MBUTTONDOWN OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Madza91 Posted January 27, 2009 Author Share Posted January 27, 2009 Hah... I forget to tell you, I know for this too, but this is bugged when add some controls, for example, create Edit or Input, and Focus it, and when is Mouse over that Edit or Input your solution wont work... [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
KaFu Posted January 27, 2009 Share Posted January 27, 2009 Last chance, add the _ispressed() to an adlib function. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Madza91 Posted January 29, 2009 Author Share Posted January 29, 2009 (edited) I founded better way - Window Proc... If someone know better way, pls post it, but i think this is perfect! Hehehe Here is code: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <GuiTab.au3> Opt('MustDeclareVars', 1) Global $ContextMenu, $CommonMenuItem, $FileMenuItem, $ExitMenuItem Global $hGui, $cInput, $wProcOld Global Const $WM_MBUTTONUP = 0x0208 _Main() Func _Main() Local $cInput2, $wProcNew, $DummyMenu, $cTab $hGui = GUICreate("Type or paste some stuff", 400, 200, -1, -1, $WS_THICKFRAME, -1) ;~ $cTab = GUICtrlCreateTab(10, 10, 350, 150) $cTab = _GUICtrlTab_Create($hGui, 10, 10, 350, 150) _GUICtrlTab_InsertItem($cTab, 0, "Some text...") GUICtrlCreateTabItem("Click here with Middle Mouse Button") $wProcNew = DllCallbackRegister("_MyWindowProc", "ptr", "hwnd;uint;long;ptr") $wProcOld = _WinAPI_SetWindowLong($cTab, $GWL_WNDPROC, DllCallbackGetPtr($wProcNew)) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>_Main Func _MyWindowProc($hWnd, $uiMsg, $wParam, $lParam) Switch $uiMsg Case $WM_MBUTTONUP MsgBox(0,"","As you can see Middle Mouse Button works... ;P") EndSwitch Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $uiMsg, $wParam, $lParam) EndFunc ;==>_MyWindowProc Edited January 29, 2009 by n3nE [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
KaFu Posted January 29, 2009 Share Posted January 29, 2009 (edited) Hmmm, doesn't work for me Edit: Oh, I see, you have to click on the tab-header... But e.g. edit-controls still consum the clicks (have no middle mouse-button on my notebook, thus I changed to left )... expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> Opt('MustDeclareVars', 1) Global $hGui, $wProcOld Global Const $WM_LBUTTONDOWN = 0x0201 _Main() Func _Main() Local $wProcNew $hGui = GUICreate("Left Click", 400, 200, -1, -1, $WS_THICKFRAME, -1) GUICtrlCreateEdit("",40,40,200,110) $wProcNew = DllCallbackRegister("_MyWindowProc", "ptr", "hwnd;uint;long;ptr") $wProcOld = _WinAPI_SetWindowLong($hGui, $GWL_WNDPROC, DllCallbackGetPtr($wProcNew)) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>_Main Func _MyWindowProc($hWnd, $uiMsg, $wParam, $lParam) Switch $uiMsg Case $WM_LBUTTONDOWN MsgBox(0,"","Left Mouse Button") EndSwitch Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $uiMsg, $wParam, $lParam) EndFunc ;==>_MyWindowProc Edited January 29, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Madza91 Posted January 29, 2009 Author Share Posted January 29, 2009 (edited) KaFu, you want to detect it on Edit ? Edit: When create Edit with GUICtrlCreateEdit, you need to get handle of it when using Func _WinAPI_SetWindowLong... Try this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> Opt('MustDeclareVars', 1) Global $hGui, $cInput, $wProcOld Global Const $WM_LBUTTONDOWN = 0x0201 _Main() Func _Main() Local $wProcNew, $edit $hGui = GUICreate("Left Click", 400, 200, -1, -1) $cInput = GUICtrlCreateEdit("",40,40,200,110) $wProcNew = DllCallbackRegister("_MyWindowProc", "ptr", "hwnd;uint;long;ptr") $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($cInput), $GWL_WNDPROC, DllCallbackGetPtr($wProcNew)) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>_Main Func _MyWindowProc($hWnd, $uiMsg, $wParam, $lParam) Switch $uiMsg Case $WM_LBUTTONDOWN MsgBox(0,"","Left Mouse Button") Return 0;and don't let default windowproc mess things up EndSwitch Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $uiMsg, $wParam, $lParam) EndFunc ;==>_MyWindowProc Edited January 29, 2009 by n3nE [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
KaFu Posted January 29, 2009 Share Posted January 29, 2009 KaFu, you want to detect it on Edit ?Eh... you wanted it, said so in reply to my GUIRegisterMsg() sugesstion.Hah... I forget to tell you, I know for this too, but this is bugged when add some controls, for example, create Edit or Input, and Focus it, and when is Mouse over that Edit or Input your solution wont work... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Madza91 Posted January 29, 2009 Author Share Posted January 29, 2009 Hehe, I wanted it, and I solved it, thank you for replies [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) 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