My application is designed to launch in full screen, at any cost taskbar should not be visible to the user. For taskbar hiding below ahk scripts will be running in the background to perform the needed operations.
Regarding AHK scripting please select the below link for its description.
http://ahkscript.org/
The script doesn`t work if "Auto Hide taskbar" functionality of windows 7 is selected.
Hence I have taken the below C# code to solve the issue from the application side.
But in certain conditions like when the application launches for the first time after windows restart, showwindow function is not working properly especially when Auto Hide taskbar option selected.
Sample Code
[DllImport("user32.dll")]
public static extern int FindWindowEx(int parentHandle, int childAfter, string className, int windowTitle);
[DllImport("user32.dll")]
private static extern int GetDesktopWindow();
[DllImport("user32.dll")]
private static extern int ShowWindow(int hwnd, int command);
protected static int Handle
{
get
{
return (int)FindWindow("Shell_TrayWnd", "");
}
}
protected static int HandleOfStartButton
{
get
{
int handleOfDesktop = GetDesktopWindow();
int handleOfStartButton = FindWindowEx(handleOfDesktop, 0, "button", 0);
return handleOfStartButton;
}
}
public static void HideTaskbar()
{
int Taskbar = ShowWindow(Handle, SW_HIDE);
int StartButton = ShowWindow(HandleOfStartButton, SW_HIDE);
}
private void button1_Click(object sender, EventArgs e)
{
HideTaskbar();
}
Script Below script hides the taskbar and disables the execution of some keys.(right window and left window button and ctrl+esc)
WinHide,ahk_class Shell_TrayWnd
LWin::Suspend
RWin::Suspend
^Esc::Suspend
other options I have tried out
[DllImport("user32.dll")]
public static extern bool SetWindowPos(
int hWnd, // handle to window
int hWndInsertAfter, // placement-order handle
short X, // horizontal position
short Y, // vertical position
short cx, // width
short cy, // height
uint uFlags // window-positioning options
);
private void button1_Click(object sender, EventArgs e)
{
int hwnd = FindWindow("Shell_TrayWnd", "");
SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);
}
Above code alters the functionality. Not working properly.
Please suggest any ways to handle this scenario.