kosamja Posted August 7, 2016 Share Posted August 7, 2016 (edited) Is it possible to hide focus rectangle for any control in any window? I tried this, but focus rectangle appears on mouse hover or click: expandcollapse popup; www.autoitscript.com/forum/topic/56536-easy-shell-hooking-example/?page=2 ; autohotkey.com/board/topic/82458-how-to-disable-the-standard-focus-rectangle/ #NoTrayIcon #include<WinAPI.au3> #include<WinAPISys.au3> #include<WindowsConstants.au3> Opt("WinWaitDelay", 0) Opt("MouseClickDelay", 0) Opt("MouseClickDownDelay", 0) Opt("MouseClickDragDelay", 0) Opt("SendKeyDelay", 0) Opt("SendKeyDownDelay", 0) Opt("WinTitleMatchMode", 3) Global Const $UISF_HIDEFOCUS = 0x10001 $hHookFunc = DllCallbackRegister('_WinEventProc', 'none', 'ptr;uint;hwnd;int;int;uint;uint') $hWinHook = _WinAPI_SetWinEventHook($EVENT_OBJECT_FOCUS, $EVENT_OBJECT_FOCUS, DllCallbackGetPtr($hHookFunc)) While 1 _HighPrecisionSleep(0.1) WEnd Func _WinEventProc($hHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iEventThread, $imsEventTime) If $iEvent = $EVENT_OBJECT_FOCUS Then _SendMessage($hWnd, $WM_CHANGEUISTATE, $UISF_HIDEFOCUS) _SendMessage($hWnd, $WM_UPDATEUISTATE, $UISF_HIDEFOCUS) EndIf EndFunc Func _HighPrecisionSleep($iMicroSeconds,$hDll=False) Local $hStruct, $bLoaded If Not $hDll Then $hDll=DllOpen("ntdll.dll") $bLoaded=True EndIf $hStruct=DllStructCreate("int64 time;") DllStructSetData($hStruct,"time",-1*($iMicroSeconds*10)) DllCall($hDll,"dword","ZwDelayExecution","int",0,"ptr",DllStructGetPtr($hStruct)) If $bLoaded Then DllClose($hDll) EndFunc Edited August 7, 2016 by kosamja Link to comment Share on other sites More sharing options...
kosamja Posted August 12, 2016 Author Share Posted August 12, 2016 bump... Just to check is this not possible without dll? Link to comment Share on other sites More sharing options...
UEZ Posted August 12, 2016 Share Posted August 12, 2016 Is this what you are looking for? -> Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
kosamja Posted August 12, 2016 Author Share Posted August 12, 2016 (edited) yes, but for every window. NoFocusLines works only for autoit gui. Edited August 12, 2016 by kosamja Link to comment Share on other sites More sharing options...
UEZ Posted August 12, 2016 Share Posted August 12, 2016 Ok, what is the purpose to do so for external windows? Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
kosamja Posted August 12, 2016 Author Share Posted August 12, 2016 to remove that ugly dotted focus rectangle... Link to comment Share on other sites More sharing options...
water Posted August 12, 2016 Share Posted August 12, 2016 So it is just for cosmetic reasons? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
kosamja Posted August 12, 2016 Author Share Posted August 12, 2016 (edited) Yes, and because its annoying since it appears on every control that is clicked or has focus. Edited August 12, 2016 by kosamja Link to comment Share on other sites More sharing options...
Developers Jos Posted August 12, 2016 Developers Share Posted August 12, 2016 Maybe I can recommend a mental coach to help you deal with a standard Windows feature? water, AutoBert and Skysnake 3 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
kosamja Posted August 12, 2016 Author Share Posted August 12, 2016 standard Windows feature I havent seen for years thanks to RemoveFocusRect.dll. Unfortunately that dll doesnt work if secure boot on UEFI is enabled since in that case AppInit_DLLs is disabled. I guess I can just disable secure boot, but I thought I can instead use autoit for removal of focus rectangle, but it looks I cant. Link to comment Share on other sites More sharing options...
Danyfirex Posted August 13, 2016 Share Posted August 13, 2016 Hello. First UISF_HIDEFOCUS constant has not that value :S It's defined as UISF_HIDEFOCUS=0x1 _HighPrecisionSleep Function is pretty wrong. Check expandcollapse popup; www.autoitscript.com/forum/topic/56536-easy-shell-hooking-example/?page=2 ; autohotkey.com/board/topic/82458-how-to-disable-the-standard-focus-rectangle/ ;~ #NoTrayIcon #include <WinAPI.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Opt("WinWaitDelay", 0) Opt("MouseClickDelay", 0) Opt("MouseClickDownDelay", 0) Opt("MouseClickDragDelay", 0) Opt("SendKeyDelay", 0) Opt("SendKeyDownDelay", 0) Opt("WinTitleMatchMode", 3) Global $hNTDll = DllOpen("ntdll.dll") ;just load once :P Global Const $UIS_SET = 1 Global Const $UIS_CLEAR = 2 Global Const $UISF_HIDEFOCUS = 0x1 OnAutoItExitRegister("_Free") Global $hHookFunc = DllCallbackRegister('_WinEventProc', 'none', 'ptr;uint;hwnd;int;int;uint;uint') Global $hWinHook = _WinAPI_SetWinEventHook($EVENT_OBJECT_CREATE, $EVENT_OBJECT_CREATE, DllCallbackGetPtr($hHookFunc)) While 1 _HighPrecisionSleep(0.1) WEnd Func _Free() If $hWinHook Then _WinAPI_UnhookWinEvent($hWinHook) If $hHookFunc Then DllCallbackFree($hHookFunc) If $hNTDll Then DllClose($hNTDll) EndFunc ;==>_Free Func _WinEventProc($hHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iEventThread, $imsEventTime) _SendMessage($hWnd, $WM_CHANGEUISTATE, _WinAPI_MakeLong($UIS_CLEAR, $UISF_HIDEFOCUS)) _SendMessage($hWnd, $WM_UPDATEUISTATE, _WinAPI_MakeLong($UIS_SET, $UISF_HIDEFOCUS)) EndFunc ;==>_WinEventProc Func _HighPrecisionSleep($iMicroSeconds) Local $hStruct = DllStructCreate("int64 time;") DllStructSetData($hStruct, "time", -1 * ($iMicroSeconds * 10)) DllCall($hNTDll, "dword", "NtDelayExecution", "int", 0, "ptr", DllStructGetPtr($hStruct)) EndFunc ;==>_HighPrecisionSleep Saludos kosamja 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut 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