topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday April 16, 2024, 6:08 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: [Compleet]: Auto replace icon in captionbar & taskbar  (Read 30722 times)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #25 on: September 28, 2009, 10:54 PM »
Is it possible just to hide them, not remove them?

I suppose one could write code to watch the mouse cursor and, if it was in the titlebar area, set the window style back to +0x80000 to show the buttons again.

Is it possible just to hide some of them, e.g. leaving the close button only?

I don't think so, but I don't know for certain.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #26 on: September 29, 2009, 01:10 AM »
Here, try this.  When you start up this version, a message box will popup asking if you want to enable the min/max/close tweak.  If you choose yes, they will be hidden upon each window's creation and they should appear whenever your mouse is in the titlebar area.  It's not perfect but it seems to work fairly well.  Also, this version leaves the tray icon in place so you can exit it.  All min/max/close buttons should be restored on exit.

Code: AutoIt [Select]
  1. /*
  2. Author:  Jody Holmes (Skwire)
  3. Date:    2009-08-23
  4. Contact: skwire@skwire.net
  5.  
  6.  
  7. v0.0.0.3 - 2009-09-29
  8.     + Added optional showing/hiding of titlebar min/max/close buttons.
  9.  
  10. v0.0.0.2 - 2009-08-28
  11.     * Hook now fires on two additional messages.
  12.         HSHELL_REDRAW
  13.         HSHELL_RUDEAPPACTIVATED
  14.  
  15. v0.0.0.1 - 2009-08-23
  16.     + Initial build.
  17.  
  18. */
  19.  
  20. ;#NoTrayIcon
  21. #Persistent
  22. #NoEnv
  23. #SingleInstance, Force
  24. SetWorkingDir, %A_ScriptDir%
  25. DetectHiddenWindows, Off
  26. OnExit, Cleanup
  27.  
  28. Menu, Tray, NoStandard
  29. Menu, Tray, Add, Exit, Cleanup
  30.  
  31. Gui +LastFound
  32. hWnd := WinExist()
  33.  
  34. ; Hook the shell.
  35. ; http://www.autohotkey.com/forum/viewtopic.php?p=123323#123323
  36. DllCall( "RegisterShellHookWindow", UInt, hWnd )
  37. MsgNum := DllCall( "RegisterWindowMessage", Str, "SHELLHOOK" )
  38. OnMessage( MsgNum, "ShellMessage" )
  39.  
  40. ; Create a blank cursor for use instead of a blank icon file.
  41. ; http://www.autohotkey.com/forum/viewtopic.php?p=220113#220113
  42. VarSetCapacity( AndMask, 32*4, 0xFF ), VarSetCapacity( XorMask, 32*4, 0 )
  43. hIcon := DllCall( "CreateCursor", Uint, 0, Int, 0, Int, 0, Int, 32, Int, 32, Uint, &AndMask, Uint, &XorMask )
  44.  
  45. ; Initial loop to blank out existing windows.
  46. WinGet, s, List
  47. Loop, % s
  48. {
  49.     s := s%A_Index%
  50.     ;SendMessage, 0x80, 0, hIcon, , % "ahk_id " . s
  51. }
  52.  
  53. MsgBox, 36, TBarIconBlanker, Would you like to enable the min/max/close buttons tweak as well?
  54. IfMsgBox, Yes
  55. {
  56.     MinMaxCloseOption := 1
  57.     SetTimer, WatchCursor, 100
  58. }
  59.  
  60. Return ; End of auto-execute section.
  61.  
  62.  
  63. ; ------------------------------------------------------------------------
  64. ; Subroutines ------------------------------------------------------------
  65. ; ------------------------------------------------------------------------
  66.  
  67. Cleanup:
  68. {
  69.     If ( MinMaxCloseOption = 1 ) ; Restore titlebar buttons on close.
  70.     {
  71.         WinGet, s, List
  72.         Loop, % s
  73.         {
  74.             s := s%A_Index%
  75.             WinSet, Style, +0x80000, % "ahk_id " . s ; Restore min/max/close buttons.
  76.         }
  77.     }
  78.     ExitApp
  79. }
  80.  
  81.  
  82. WatchCursor:
  83. {
  84.     MouseGetPos, , yPos, CurrID,
  85.     If ( yPos >= 0 and yPos < 22 )
  86.     {
  87.         WinSet, Style, +0x80000, % "ahk_id " . CurrID ; Restore min/max/close buttons.
  88.     }
  89.     Else
  90.     {
  91.         WinSet, Style, -0x80000, % "ahk_id " . PrevID ; Get rid of min/max/close buttons.
  92.         WinSet, Style, -0x80000, % "ahk_id " . CurrID ; Get rid of min/max/close buttons.
  93.     }
  94. }
  95.  
  96.  
  97. ; ------------------------------------------------------------------------
  98. ; Functions --------------------------------------------------------------
  99. ; ------------------------------------------------------------------------
  100.  
  101. ; Shell hook to blank out windows that are subsequently created.
  102. ShellMessage( wParam, lParam )
  103. {
  104.     Global hIcon, MinMaxCloseOption, PrevID
  105.     If wParam in 1,6,32772
  106.     {
  107.         SendMessage, 0x80, 0, hIcon, , % "ahk_id " . lParam ; Blank out titlebar and taskbar icons.
  108.         If ( MinMaxCloseOption = 1 )
  109.         {
  110.             WinSet, Style, -0x80000, % "ahk_id " . lParam ; Get rid of min/max/close buttons.
  111.         }
  112.     }
  113.     PrevID := lParam
  114. }

tmpusr

  • Member
  • Joined in 2005
  • **
  • Posts: 154
  • Instantiation stuck in meatspace with no backup
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #27 on: September 29, 2009, 04:42 AM »
Thanks. This is great.  :Thmbsup: I'll be running this on all my systems forever. :D

If only one could have the same for the Explorer toolbar buttons, the start button, the tray. A universal auto-hide for buttons and other UI elements - the minimalist's dream.

Can you make it not restore the window icon along with the buttons when hovering? It sometimes shows them, sometimes doesn't. I'd like to have an INI option for the behavior.

Can you restore the icon in the toolbar when hovering, either on the button or in toolbar area?

Can you make it work when hovering on background windows?

Can you blank out the window borders - make them transparent - in a similar fashion? If not blank out, then fill with some solid color. It would be neat to have borderless windows that only appear when hovering.

Can you blank out the right side of the Explorer statusbar (which, I just noticed, in Explorer menu is "Status Bar" which seems inconsistent with the way "Taskbar" is written), the part that has the unnecessary My Computer/Internet or simply fill it with a solid rectangle and remove it when hovering? The user would have to match the color and perhaps the height to the visual style - unless there are system variables for those that you can use.

Can you use a system variable to find out the actual height of the titlebar instead of the fixed value, 22? I use a larger title bar and it ony shows when I'm at the top 22.

Can you remove the empty space occupied by the invisible icon in front of the taskbar buttons?

I'd prefer it to ask nothing upon startup and default to hide buttons and have no tray icon.

Bug: Right clicking taskbar button doesn't bring up the menu (though sometimes it does).

Bug: Buttons not removed on command line window.

Bug-like behavior (due to implementation, if I'm correct): it keeps blinking with TeraCopy and 7-Zip, that update the % done in the titlebar.
« Last Edit: September 29, 2009, 06:21 AM by tmpusr »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #28 on: September 29, 2009, 06:46 AM »
This version checks the system for titlebar height so it should work better with your system.  It also attempts to keep the titlebar icon hidden when restoring the min/max/close buttons.  It also does away with the message box at the start and the tray icon.

As for your other requests, I really don't want to develop this app any further in all these other directions.  There are so many variables at play here and so many different system configurations that I simply have no desire to get knee-deep in trying to troubleshoot/fix/hack/whatever.  Feel free to study the code and take it further on your own.  There really isn't a whole lot of complex code in this script.  Here you go:

Code: AutoIt [Select]
  1. /*
  2. Author:  Jody Holmes (Skwire)
  3. Date:    2009-08-23
  4. Contact: skwire@skwire.net
  5.  
  6.  
  7. v0.0.0.3 - 2009-09-29
  8.     + Added optional showing/hiding of titlebar min/max/close buttons.
  9.  
  10. v0.0.0.2 - 2009-08-28
  11.     * Hook now fires on two additional messages.
  12.         HSHELL_REDRAW
  13.         HSHELL_RUDEAPPACTIVATED
  14.  
  15. v0.0.0.1 - 2009-08-23
  16.     + Initial build.
  17.  
  18. */
  19.  
  20. #NoTrayIcon
  21. #Persistent
  22. #NoEnv
  23. #SingleInstance, Force
  24. SetWorkingDir, %A_ScriptDir%
  25. DetectHiddenWindows, Off
  26. OnExit, Cleanup
  27. SysGet, TBarHeight, 4
  28.  
  29. Menu, Tray, NoStandard
  30. Menu, Tray, Add, Exit, Cleanup
  31.  
  32. Gui +LastFound
  33. hWnd := WinExist()
  34.  
  35. ; Hook the shell.
  36. ; http://www.autohotkey.com/forum/viewtopic.php?p=123323#123323
  37. DllCall( "RegisterShellHookWindow", UInt, hWnd )
  38. MsgNum := DllCall( "RegisterWindowMessage", Str, "SHELLHOOK" )
  39. OnMessage( MsgNum, "ShellMessage" )
  40.  
  41. ; Create a blank cursor for use instead of a blank icon file.
  42. ; http://www.autohotkey.com/forum/viewtopic.php?p=220113#220113
  43. VarSetCapacity( AndMask, 32*4, 0xFF ), VarSetCapacity( XorMask, 32*4, 0 )
  44. hIcon := DllCall( "CreateCursor", Uint, 0, Int, 0, Int, 0, Int, 32, Int, 32, Uint, &AndMask, Uint, &XorMask )
  45.  
  46. ; Initial loop to blank out existing windows.
  47. WinGet, s, List
  48. Loop, % s
  49. {
  50.     s := s%A_Index%
  51.     ;SendMessage, 0x80, 0, hIcon, , % "ahk_id " . s
  52. }
  53.  
  54. ; MsgBox, 36, TBarIconBlanker, Would you like to enable the min/max/close buttons tweak as well?
  55. ; IfMsgBox, Yes
  56. ; {
  57. ;     MinMaxCloseOption := 1
  58. ;     SetTimer, WatchCursor, 100
  59. ; }
  60. MinMaxCloseOption := 1
  61. SetTimer, WatchCursor, 100
  62.  
  63. Return ; End of auto-execute section.
  64.  
  65.  
  66. ; ------------------------------------------------------------------------
  67. ; Subroutines ------------------------------------------------------------
  68. ; ------------------------------------------------------------------------
  69.  
  70. Cleanup:
  71. {
  72.     If ( MinMaxCloseOption = 1 ) ; Restore titlebar buttons on close.
  73.     {
  74.         WinGet, s, List
  75.         Loop, % s
  76.         {
  77.             s := s%A_Index%
  78.             WinSet, Style, +0x80000, % "ahk_id " . s ; Restore min/max/close buttons.
  79.         }
  80.     }
  81.     ExitApp
  82. }
  83.  
  84.  
  85. WatchCursor:
  86. {
  87.     MouseGetPos, , yPos, CurrID,
  88.     If ( yPos >= 0 and yPos < ( TBarHeight + 3 ) )
  89.     {
  90.         WinSet, Style, +0x80000, % "ahk_id " . CurrID ; Restore min/max/close buttons.
  91.         SendMessage, 0x80, 0, hIcon, , % "ahk_id " . CurrID ; Blank out titlebar and taskbar icons.
  92.     }
  93.     Else
  94.     {
  95.         WinSet, Style, -0x80000, % "ahk_id " . PrevID ; Get rid of min/max/close buttons.
  96.         WinSet, Style, -0x80000, % "ahk_id " . CurrID ; Get rid of min/max/close buttons.
  97.         SendMessage, 0x80, 0, hIcon, , % "ahk_id " . CurrID ; Blank out titlebar and taskbar icons.
  98.     }
  99. }
  100.  
  101.  
  102. ; ------------------------------------------------------------------------
  103. ; Functions --------------------------------------------------------------
  104. ; ------------------------------------------------------------------------
  105.  
  106. ; Shell hook to blank out windows that are subsequently created.
  107. ShellMessage( wParam, lParam )
  108. {
  109.     Global hIcon, MinMaxCloseOption, PrevID
  110.     If wParam in 1,6,32772
  111.     {
  112.         SendMessage, 0x80, 0, hIcon, , % "ahk_id " . lParam ; Blank out titlebar and taskbar icons.
  113.         If ( MinMaxCloseOption = 1 )
  114.         {
  115.             WinSet, Style, -0x80000, % "ahk_id " . lParam ; Get rid of min/max/close buttons.
  116.         }
  117.     }
  118.     PrevID := lParam
  119. }




tmpusr

  • Member
  • Joined in 2005
  • **
  • Posts: 154
  • Instantiation stuck in meatspace with no backup
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #29 on: September 29, 2009, 08:38 AM »
Thanks again.

Could you take a look at the changed taskbar button behavior: in many cases you need to click it twice until the window minimizes. And the right click menu is missing.

If you don't want to work on them, do you whether they are possible, like the overlaying of window borders with a solid color unless hovering there?

Without the buttons and icons the system looks much cleaner. I think this should be an option in Win 8 or Win 7 SP1, it's that good.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #30 on: September 29, 2009, 08:59 AM »
Could you take a look at the changed taskbar button behavior: in many cases you need to click it twice until the window minimizes. And the right click menu is missing.
Unfortunately, that's a side-effect of getting rid of the buttons.  The 0x80000 style is WM_SYSMENU.  So, basically, the code removes the window's system menu (the one you normally see when right-clicking or using the alt-space hotkey).

Honestly, for the amount of customisation you want to do, you may want to look into alternate Windows shell.  I, for instance, run a branch of the bb4Win shell called bbClean.  Using the bbLeanSkin plugin, you can specify which titlebar buttons to show (or none), whether or not icons show in the titlebar, etc.  Also, you can make the taskbar and tray icons greyscale, colour-muted, and on and on.  Take a look at the screenshots at http://www.boxshots.org for ideas.  You can see a screenshot of what my desktop typically looks like in an earlier post in this thread: https://www.donation....msg175110#msg175110

tmpusr

  • Member
  • Joined in 2005
  • **
  • Posts: 154
  • Instantiation stuck in meatspace with no backup
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #31 on: September 29, 2009, 09:21 AM »
Wouldn't it be fixed simply by detecting that you're hovering over the taskbar and restoring the buttons - and thereby normal functionality - while you're there?

I'm pretty happy with the Explorer shell, but I'll take a look at BB.

I'm interested in the concept of stuff appearing only when you're near it. See nothing unless you're going to use it momentarily. Keep visual clutter to a minimum.

If you or someone could make the "hide window borders or overlay them with color while not near them", there's not much more I could think of improving - except for showing the icons in the taskbar at the same time as you're hovering over them. Which made me wonder, could you show the taskbar icons, but only while hovering over a window title?

Is it possible to show the window icon, too, when the buttons appear?

Is it possible to change the title bar font color and/or background color while you're hovering on it? I'd like to see it dim when I'm not near it, and get bright when hovering. The same goes for the taskbar text.

Is it possible to completely hide the titlebar until you move near it? So that the window actually is smaller and tiles as if it doesn't have the titlebar, but then the titlebar pops up when you're near it. The same for the statusbar too - auto-hide window titlebar and statusbar.

And heaps of thanks for your efforts. This has significantly changed the aesthetics of the OS for the better.
« Last Edit: September 29, 2009, 09:33 AM by tmpusr »

tmpusr

  • Member
  • Joined in 2005
  • **
  • Posts: 154
  • Instantiation stuck in meatspace with no backup
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #32 on: September 29, 2009, 09:37 AM »
Found a great free app to remove all lines and rectangles from the taskbar, and to blank out the start button, leaving just an empty area of the size you can control, and to hide or replace the clock.
You can make the taskbar completely flat.
http://homepage1.nif...kazubon/tclocklight/


lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #33 on: April 10, 2010, 01:35 PM »
this nifty tool was featured here.. :up:

http://www.askvg.com...and-taskbar-buttons/

thwack

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #34 on: February 27, 2014, 01:09 PM »
sorry to bring an old topic but it's not working anymore, someone could fix it? there s still icons on certain apps, like firefox etc...

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: [Compleet]: Auto replace icon in captionbar & taskbar
« Reply #35 on: February 27, 2014, 01:54 PM »
Hi, thwack, and welcome to the DonationCoder site.

sorry to bring an old topic but it's not working anymore, someone could fix it? there s still icons on certain apps, like firefox etc...

Unfortunately, this code was written four years ago for Windows XP and I'm not certain I'm too interested in updating it for Windows 7.  The code should be in the archive so you're welcome to do whatever you want with it.