tabnation

window around active win

Jan 28th, 2023
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #Persistent
  2.  
  3. ; windows in windows 10 has thick invisible boarder which is about 4 pixels wide.
  4.  
  5. SetTimer, DrawRect, 50
  6. border_thickness = 4
  7.  
  8. ; set the color of the border
  9. border_color = ffae00
  10.  
  11.  
  12. DrawRect:
  13.  
  14. ; Get the current window's position
  15. WinGetPos, x, y, w, h, A
  16. ; To avoid the error message
  17. if (x="")
  18. return
  19.  
  20. ;Gui, +Lastfound +AlwaysOnTop +Toolwindow
  21. Gui, +Lastfound +AlwaysOnTop
  22.  
  23. ; set the background for the GUI window
  24. Gui, Color, %border_color%
  25.  
  26. ; remove thick window border of the GUI window
  27. Gui, -Caption
  28.  
  29. ; Retrieves the minimized/maximized state for a window.
  30. WinGet, notMedium , MinMax, A
  31.  
  32. if (notMedium==0){
  33. ; 0: The window is neither minimized nor maximized.
  34.  
  35. offset:=0
  36. outerX:=offset
  37. outerY:=offset
  38. outerX2:=w-offset
  39. outerY2:=h-offset
  40.  
  41. innerX:=border_thickness+offset
  42. innerY:=border_thickness+offset
  43. innerX2:=w-border_thickness-offset
  44. innerY2:=h-border_thickness-offset
  45.  
  46. newX:=x
  47. newY:=y
  48. newW:=w
  49. newH:=h
  50.  
  51. WinSet, Region, %outerX%-%outerY% %outerX2%-%outerY% %outerX2%-%outerY2% %outerX%-%outerY2% %outerX%-%outerY% %innerX%-%innerY% %innerX2%-%innerY% %innerX2%-%innerY2% %innerX%-%innerY2% %innerX%-%innerY%
  52.  
  53. Gui, Show, w%newW% h%newH% x%newX% y%newY% NoActivate, GUI4Boarder
  54. return
  55. } else {
  56. WinSet, Region, 0-0 w0 h0
  57. return
  58. }
  59.  
  60. return
Add Comment
Please, Sign In to add comment