Full screen for WM/CF

Since I do some Compact Framework programming on the side. I ran into the problem on how to do full screen applications on WM. Due to our background as “third level developers” we got a pretty good framework for C# Compact Framework programming and there I found the good old HHTaskBar “Hack”.

public static class TaskBar
{
    private static IntPtr taskbar; 

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

    [DllImport("coredll.dll")]
    private static extern IntPtr ShowWindow(IntPtr hWnd, int visible); 

    [DllImport("coredll.dll")]
    private static extern bool EnableWindow(IntPtr hwnd, bool enabled); 

    /// <summary>
    /// hides windows taskbar
    /// </summary>
    public static void HideTaskbar()
    {
        taskbar = FindWindowCE("HHTaskBar", null);
        ShowWindow(taskbar, 0);
        EnableWindow(taskbar, false);
    } 

    /// <summary>
    /// shows windows taskbar
    /// </summary>
    public static void ShowTaskbar()
    {
        ShowWindow(taskbar, 1);
        EnableWindow(taskbar, true);
    } 

}

This is fine,… but if the app crashes or you forget to implement the  ”ShowTasbar” function your TaskBar is gone (till the next cold reset). So I searched and found the following “lightweight” way to “hide” the TaskBar.

public static void FullSize(Form frm)
{
    frm.WindowState = FormWindowState.Maximized;
    frm.Size = Screen.PrimaryScreen.WorkingArea.Size;
    frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
}

Only tested for WM 5.0, 6.0 and 6.5!

About Richard Deininger

Experimental Developer, Technical Consultant, EA Addin Bastler

3 comments on “Full screen for WM/CF

  1. Pingback: Unsere WM-App: Jetzt für 79 Cent | Tea

  2. Pingback: Hi, Smartphone » Blog Archive » Full screen for WM/CF | LieberLieber Software TeamBlog

  3. Pingback: Hi, Smartphone » Blog Archive » Full screen for WM/CF | LieberLieber Software TeamBlog

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>