Does anyone know how I can automatically hide the task bar in windows 7 via command line or some other method?
Here's a little C program that will toggle the hidden/shown state of the taskbar window. Note that when it's hidden it's actually gone from the screen completely (it's not in auto-hide mode).
#include <windows.h>
int main() {
HWND hwnd = FindWindow("Shell_traywnd", "");
if (IsWindowVisible(hwnd))
SetWindowPos(hwnd,0,0,0,0,0,SWP_HIDEWINDOW);
else
SetWindowPos(hwnd,0,0,0,0,0,SWP_SHOWWINDOW);
return 0;
}
Using SHAppBarMessage. This one toggles the autohide state.
#include <windows.h>
#include <shellapi.h>
// This isn't defined for me for some reason.
#ifndef ABM_SETSTATE
#define ABM_SETSTATE 0x0000000A
#endif
int main() {
APPBARDATA abd = {sizeof abd};
UINT uState = (UINT) SHAppBarMessage(ABM_GETSTATE, &abd);
LPARAM param = uState & ABS_ALWAYSONTOP;
if (uState & ABS_AUTOHIDE)
abd.lParam = param;
else
abd.lParam = ABS_AUTOHIDE | param;
SHAppBarMessage(ABM_SETSTATE, &abd);
return 0;
}