I was looking for something like this for a while, and this thread helped me finally make something that works, so I figured I would let people know how to do it.
Thanks very much to EricCartman for the function calls, really all I did was fix the structure of the code.
Eric's code was working perfectly until I realized it was using 25% processor

when the taskbar was showing.
This code uses no looping mechanisms, so it doesn't do anything except when you want it to.
Code:
{
DetectHiddenWindows, On
VarSetCapacity( APPBARDATA, 36, 0 )
NumPut( ( ABS_ALWAYSONTOP := 0x2 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
Sleep 10 ;Sometimes the bar doesn't get hidden 'all of the way' this prevents that.
WinHide ahk_class Shell_TrayWnd
} ;If you want the taskbar to start visible, delete this block.
x=1
f12:: ;The key used to toggle the taskbar. Change it as you like.
{
If x=0
{
NumPut( ( ABS_ALWAYSONTOP := 0x2 ), APPBARDATA, 32, "UInt" )
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
WinShow ahk_class Shell_TrayWnd
x=1
return
}
If x=1
{
DetectHiddenWindows, On
VarSetCapacity( APPBARDATA, 36, 0 )
NumPut( ( ABS_ALWAYSONTOP := 0x2 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
Sleep 10
WinHide ahk_class Shell_TrayWnd
x=0
return
}
}
For people wondering how to 'install'/ 'where' to write this (as I did at first): 1-Download and install autohotkey. 2-Simply copy the above code and paste it into notepad. 3-save this file as a .ahk file. 4-open the file to run the script.
I'm not sure how to get this to happen automatically when you log in, but I don't know that much about autohotkey. I'm sure there is some way to do it if you look
Hope this helps.
First, Thank you for the script. This is the info I was looking for.
I noticed a few problems with the script and was wondering if some one could help me resolve them.
1. When my laptop goes to sleep and then wakes back up the auto hide mechanism is active again. In other words if you move your pointer down to the bottom of the screen the task bar jumps up. Now of course you can reactivate the intended behavior by pressing F12 twice, but I would like to find out how to prevent this from happening when returning from sleep mode.
2. If you press the windows key while the taskbar is hidden, the windows logo button remains visible and active after pressing the windows-key again.
I've thought of some code that will fix number two, but I'm not sure how to fix number one. I did find a post on how to detect sleep mode and returning from sleep mode:
It seems possible to re-initiate the the stay hidden function using the code in that thread, but there must be a more elegant solution than that.