Toyley2 Posted March 29, 2022 Share Posted March 29, 2022 (edited) This code is mostly from some Swedish sounding guy on the forum (sorry - I can't find the post or his name - think it's Lars) The code to stop Windows bringing up a popup works for an input box on the GUI but not for a combo box - what am I doing wrong ? Global $TuneTypes = GUICtrlCreateCombo("", 600+19, 380, 247, 19) ; Combo box to select Recorder type Global $hInput2 = GUICtrlGetHandle( $TuneTypes ) ; Register callback function to subclass Input control for $hInput2 Local $pInputProc = DllCallbackGetPtr( DllCallbackRegister( "InputProc", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr" ) ) _WinAPI_SetWindowSubclass( $hInput2, $pInputProc, 9999, 0 ) ; SubclassId = 9999, $pData = 0 ; InputProc callback function Func InputProc( $hWnd, $iMsg, $wParam, $lParam, $iSubclassId, $pData ) Switch $iMsg Case $WM_CONTEXTMENU, $WM_PASTE, $EM_SHOWBALLOONTIP Return 0 EndSwitch ; Call next function in subclass chain Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam )[0] ; _WinAPI_DefSubclassProc EndFunc Edited March 29, 2022 by Toyley2 Link to comment Share on other sites More sharing options...
Danp2 Posted March 29, 2022 Share Posted March 29, 2022 The original code can be found here -- I suggest that you review this thread -- Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted March 29, 2022 Share Posted March 29, 2022 (edited) It may not be possible with the subclassing method to intercept the right-click on a combo-box as I have not found the right notification to block it. But with this hook, it is working just fine : #include <WinAPIProc.au3> #include <GUIConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <WinAPIConstants.au3> #include <Array.au3> Global $hGui = GUICreate("Example") Global $TuneTypes = GUICtrlCreateCombo("", 20, 20, 247, 19) Global $aPos = ControlGetPos ($hGui, "", $TuneTypes) Global $hStub = DllCallbackRegister(MyProc, "LRESULT", "int;wparam;lparam") Global $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE, DllCallbackGetPtr($hStub), 0, _WinAPI_GetCurrentThreadId()) GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete($hGui) _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub) Func MyProc($iMsg, $wParam, $lParam) If $iMsg = 0 Then If $wParam = $WM_RBUTTONDOWN Then Local $tPoint = DllStructCreate($tagPOINT, $lParam) _WinAPI_ScreenToClient($hGui, $tPoint) If $tPoint.X >= $aPos[0] And $tPoint.X < $aPos[0] + $aPos[2] And $tPoint.Y >= $aPos[1] And $tPoint.Y < $aPos[1] + $aPos[3] Then Return 1 EndIf EndIf EndIf Return _WinAPI_CallNextHookEx($hHook, $iMsg, $wParam, $lParam) EndFunc ;==>MyProc ps. next time please provide a runable script so we can test it and modify it without rewriting the whole script for you. Thanks in advance. Edited March 29, 2022 by Nine Danp2 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Toyley2 Posted March 29, 2022 Author Share Posted March 29, 2022 Thank you for the advice and help sorry Nine - I thought it was just a syntax problem (jumping to conclusions) - I'll put something runnable next time I need help :-) 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