|
here is how you hide windows 7 start menu and show full windows in C# .net winform
public System.Drawing.Color colorActiveColor = System.Drawing.Color.Black;
private const int SW_HIDE = 0;
private const int SW_SHOW = 1;
[DllImport("user32.dll")]
private static extern int FindWindow(string className, string windowText);
[DllImport("user32.dll")]
private static extern int ShowWindow(int hwnd, int command);
[DllImport("user32.dll")]
private static extern int EnableWindow(int hwnd, bool command);
[DllImport("user32.dll")]
private static extern int FindWindowEx(int hwndParent, int hwndChildAfter, string className, string windowText);
[DllImport("user32.dll")]
private static extern int GetDesktopWindow();
int hwndParent = 0;
int hwnd = 0;
public void FullScreen()
{
HideStartMenu();
menuStrip1.Visible = false;
statusStrip1.Visible= false;
frmMain.ActiveForm.TopMost = true;
frmMain.ActiveForm.FormBorderStyle = FormBorderStyle.None;
frmMain.ActiveForm.WindowState = FormWindowState.Maximized;
panelMain.BackColor = System.Drawing.Color.Black;
panelMain.Dock = DockStyle.Fill;
}
public void Normal()
{
menuStrip1.Visible = true;
statusStrip1.Visible = true;
frmMain.ActiveForm.WindowState = FormWindowState.Normal;
frmMain.ActiveForm.FormBorderStyle = FormBorderStyle.Fixed3D;
frmMain.ActiveForm.TopMost = false;
panelMain.BackColor = colorActiveColor;
panelMain.Dock = DockStyle.Fill;
ShowStartMenu();
}
public void HideStartMenu()
{
hwndParent = FindWindow("Shell_TrayWnd", "");
hwnd = FindWindowEx(GetDesktopWindow(), 0, "BUTTON", "Start");
ShowWindow(hwndParent, SW_HIDE);
ShowWindow(hwnd, SW_HIDE);
}
public void ShowStartMenu()
{
hwndParent = FindWindow("Shell_TrayWnd", "");
hwnd = FindWindowEx(GetDesktopWindow(), 0, "BUTTON", "Start");
ShowWindow(hwndParent, SW_SHOW);
ShowWindow(hwnd, SW_SHOW);
}
|