All Forums
 Microsoft Windows CE
 .NET Application Development
 Hiding the Taskbar
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

ctacke

877 Posts

Posted - 09 Jul 2003 :  17:42:09  Show Profile  Email Poster
How can I hide the Windows CE Taskbar through managed code?

Below is code in both C# and VB.NET for hiding the Taskbar.

Keep in mind that once you run the code the taskbar will still be "visible" until your application does something to paint over it, as the desktop window does not cover this area.

If your goal is to prevent users from accessing the Windows CE system itself, you might also consider removing the CE Desktop altogether.

For the unmanaged version of this code, see Topic 39


C#

using System.Runtime.InteropServices;

[DllImport("coredll.dll", EntryPoint="FindWindowW", SetLastError=true)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

[DllImport("coredll.dll", EntryPoint="ShowWindow", SetLastError=true)]
private static int ShowWindow(IntPtr hwnd, int nCmdShow);

[DllImport("coredll.dll", EntryPoint="EnableWindow", SetLastError=true)]
private static int EnableWindow(IntPtr hwnd, int bEnable);

public void HideTaskBar()
{
   private const int SW_HIDE = 0;

   IntPtr hTaskBar = FindWindow("HHTaskBar", null);
   if(hTaskBar != IntPtr.Zero)
   {
      EnableWindow(hTaskBar, 0);
      ShowWindow(hTaskBar, SW_HIDE);
   }
}


VB.NET

Imports System.Runtime.InteropServices

_
Public Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function

_
Public Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Integer
End Function

_
Public Function EnableWindow(ByVal hWnd As IntPtr, ByVal bEnable As Integer) As Integer
End Function

Public Sub HideTaskBar()
   Const SW_HIDE As Integer = 0

   Dim hTaskBar As IntPtr

   hTaskBar = FindWindow("HHTaskBar", Nothing)
   If hTaskBar.ToInt32 <> 0 Then
      EnableWindow(hTaskBar, 0)
      ShowWindow(hTaskBar, SW_HIDE)
   End If
End Sub


  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.02 seconds. Snitz Forums 2000