It won't truncate ToolTip text in some Apps anymore.
It will set user defined Font size (and optionally Font type) to the standard ToolTips (Ahk's, OS's & other Apps) shown on the screen.
Generally it won't change AutoHotkey's ToolTip(s) already changed by their scripts. If such script is using Fnt library Sleep -1 after ToolTip some text seems to help, preventing ToolTipAll of making changes again.
Code: Select all
#NoEnv
#SingleInstance Force
;~ #Persistent
SetBatchLines, -1
global Tt_Update, hFont, UnhkWE, GlobF
HookProcAdr := RegisterCallback( "HookProc", "F" )
hWinEventHook := SetWinEventHook( 0x8002, 0x8002, 0, HookProcAdr, 0, 0, 0) ; 0x8002 show events
OnExit, HandleExit
Return
;Based on Serenity's hook https://autohotkey.com/board/topic/32662-tool-wineventhook-messages/
HookProc( hWinEventHook, Event, hWnd, idObject, idChild, dwEventThread, dwmsEventTime ) {
WinGetClass, class, ahk_id %hWnd%
If (class = "tooltips_class32") {
if !Tt_Update {
if !hFont
hFont:=Fnt_CreateFont("", "s16") ;set the font size (and optionally font type)
Tt_Update:= 1
SendMessage 0x30, hFont, 0,, ahk_id %hwnd% ; 0x30 WM_SETFONT
SendMessage 0x418, 0, 800,, ahk_id %hwnd% ; 0x418 TTM_SETMAXTIPWIDTH
SendMessage 0x41D, 0, 0,, ahk_id %hwnd% ; 0x41D TTM_UPDATE
}
SetTimer, ResetTt_Update, -0
}
}
ResetTt_Update:
Tt_Update:= ""
return
SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags) {
DllCall("CoInitialize", Uint, 0)
return DllCall("SetWinEventHook"
, UInt, eventMin
, UInt, eventMax
, Ptr, hmodWinEventProc
, Ptr, lpfnWinEventProc
, UInt, idProcess
, UInt, idThread
, UInt, dwFlags
, Ptr)
}
UnhookWinEvent() {
Global
UnhkWE:= DllCall( "UnhookWinEvent", Ptr, hWinEventHook )
;GlobF:= DllCall( "GlobalFree", Ptr, &HookProcAdr, Ptr ) ; free up allocated memory for RegisterCallback
}
+Esc::
!F2::
HandleExit:
if hTTFont
Fnt_DeleteFont(hTTFont)
UnhookWinEvent()
if (A_ThisLabel = "!F2")
Reload
ExitApp
Return
; jballi's https://autohotkey.com/boards/viewtopic.php?f=6&t=4379&hilit=fnt+fonts
#Include, C:\Users\RRR\My Ahk-s\Fnt\Fnt.ahk
First Post
Known Limitations:- Changed ToolTip will be shown with underlined Font. (Can't get rid of it, but let's see it form a positive side: from a distance underlined text is easier to follow!)
- Probable memory leakage at exiting the script. AFAIK negligible.