Advertisement
Lorenzo501

Critical/Sleep Event Test.ahk

Mar 22nd, 2024
1,636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Requires AutoHotkey 2.0
  2. EVENT_OBJECT_NAMECHANGE := 0x800C
  3. DllCall("SetWinEventHook",
  4.     "UInt", EVENT_OBJECT_NAMECHANGE,
  5.     "UInt", EVENT_OBJECT_NAMECHANGE,
  6.     "Ptr", 0,
  7.     "Ptr", CallbackCreate(HandleTabsOutlinerEvent),
  8.     "UInt", 0,
  9.     "UInt", 0,
  10.     "UInt", 0)
  11.  
  12. HandleTabsOutlinerEvent(hWinEventHook, event, hWnd, *)
  13. {
  14.     static count := 0, text := ""
  15.  
  16.     try
  17.         if (WinGetTitle(hWnd) = "_crx_eggkanocgddhmamlbiijnphhppkpkmkl")
  18.         {
  19.             Critical(-1) ; (W/ BUSY-WAIT) 1 1 2 2 3 3 when uncommented, 1 2 3 3 2 1 when commented-out
  20.             Tooltip(text .= " " (id := ++count))
  21.             loop (8000000) ; Approx. 2sec busy-wait (has approx. 30% CPU usage at most)
  22.                 continue
  23.             ;Sleep(-1) ; (W/ CRITICAL ON) 1 2 3 3 2 1 when uncommented, 1 1 2 2 3 3 when commented-out
  24.             Tooltip(text .= " " id)
  25.         }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement