Could somebody post code that disables and/or hides Windows taskbar and enables it when I or user click on the button in Form.
Goran
Could somebody post code that disables and/or hides Windows taskbar and enables it when I or user click on the button in Form.
Goran
disabling and/or hiding Windows taskbar
Arun-YEG
hoy
I have tested this class on Windows XP, here is the code:
public class Taskbar
{
[DllImport( "user32.dll" )]
private static extern int FindWindow( string className, string windowText );
[DllImport( "user32.dll" )]
private static extern int ShowWindow( int hwnd, int command );
private const int SW_HIDE = 0;
private const int SW_SHOW = 1;
protected static int Handle
{
get
{
return FindWindow( "Shell_TrayWnd", "" );
}
}
private Taskbar()
{
// hide ctor
}
public static void Show()
{
ShowWindow( Handle, SW_SHOW );
}
public static void Hide()
{
ShowWindow( Handle, SW_HIDE );
}
}
Using:
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Taskbar.Hide();
Application.ApplicationExit += new EventHandler( Application_ApplicationExit );
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain());
}
static void Application_ApplicationExit( object sender, EventArgs e )
{
Taskbar.Show();
}
cadi
If you want true Full Screen app, you need to request it from WinAPI.
Detailed explanation is here:
How to make Windows Form app truly Full Screen (and to hide Taskbar) in C#
(based on: KB Article Q179363: How To Cover the Task Bar with a Window )
Most important piece of code is:
--
Regards,
Dejan Vesi
MCP & MCAD for .Net technologies
Home: http://www.vesic.org/english/
Blog: http://www.vesic.org/english/blog/
MikeElliott
[DllImport("user32.dll")]
private static extern int FindWindow(string className, string windowText);
[DllImport("user32.dll")]
private static extern int ShowWindow(int hwnd, int command);
private const int SW_HIDE = 0;
private const int SW_SHOW = 1;
Usage:
int hwnd = FindWindow("Shell_TrayWnd","");
ShowWindow(hwnd,SW_HIDE);
buick27
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices; // add this
namespace server_1._
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
Good luck!!
PGI Dev
Koos Brandt
Ulzii
using System;
using System.Runtime.InteropServices;
public class Taskbar
{
[DllImport("user32.dll")]
private static extern int FindWindow(string className, string windowText);
[DllImport("user32.dll")]
private static extern int ShowWindow(int hwnd, int command);
private const int SW_HIDE = 0;
private const int SW_SHOW = 1;
private int _taskbarHandle;
public Taskbar()
{
_taskbarHandle = FindWindow("Shell_TrayWnd","");
}
public void Show()
{
ShowWindow(_taskbarHandle, SW_SHOW);
}
public void Hide()
{
ShowWindow(_taskbarHandle, SW_HIDE);
}
}
Using:
Taskbar taskbar = new Taskbar();
taskbar.Hide();
pharries
Ron L.
Kerem Baser