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!

Share and Enjoy:
  • Technorati
  • Digg
  • Facebook
  • del.icio.us
  • Live
  • Google Bookmarks
  • DotNetKicks
  • DZone
  • TwitThis
  • Blogosphere News
  • Blogplay
  • LinkedIn
  • MisterWong
  • MisterWong.DE
  • MSN Reporter
  • MyShare
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Webnews.de
  • Yahoo! Bookmarks
  • Yigg

3 Responses to “Full screen for WM/CF”

  1. [...] Full screen for WM/CF | LieberLieber Software TeamBlog [...]

  2. [...] Original post: Full screen for WM/CF | LieberLieber Software TeamBlog [...]

  3. [...] View original post here: Full screen for WM/CF | LieberLieber Software TeamBlog [...]

Leave a Reply