none
Fullscreen with taskbar in front

    Question

  • Hello,

     

    I have a fullscreen application, but sometimes the taskbar gets in front and stays in front. Any idea why? Sometimes closing and restarting the app doesn't even help. I have to softreset the device. It seems random when this happens.

     

    Thanks,

     

    Marthijn.

    Tuesday, January 08, 2008 7:51 AM

Answers

  • You can try to completely hide the taskbar when you go to fullscreen mode.  It will require you to P/Invoke a couple of functions (specifically "FindWindow" and "ShowWindow")

     

    Then to hide the taskbar you can just do

     

    ShowWindow(FindWindow("HHTaskBar", null), 0)

     

     

    Then to restore the taskbar, which you must do or you will "lose" the taskbar for all apps, do:

     

    ShowWindow(FindWindow("HHTaskBar", null), 13)

     

     

    Hopefully that works.

    Wednesday, January 09, 2008 5:57 PM

All replies

  • I have a similar problem... The taskbar appears when I change from one screen to the following one. It's also a fullscreen application. How can I get rid of the taskbar?? Thanks!
    Wednesday, January 09, 2008 4:03 PM
  • You can try to completely hide the taskbar when you go to fullscreen mode.  It will require you to P/Invoke a couple of functions (specifically "FindWindow" and "ShowWindow")

     

    Then to hide the taskbar you can just do

     

    ShowWindow(FindWindow("HHTaskBar", null), 0)

     

     

    Then to restore the taskbar, which you must do or you will "lose" the taskbar for all apps, do:

     

    ShowWindow(FindWindow("HHTaskBar", null), 13)

     

     

    Hopefully that works.

    Wednesday, January 09, 2008 5:57 PM
  • How would I integrate it in my application? I send you a piece of code:

    Code Block

    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;

    namespace DesdeCero
    {
        public class Program
        {
            FormMain fm;
            FormSecond fs;
            FormBase fb = new FormBase();

            public static void Main()
            {
                Program wa = new Program();
                wa.fb.Paint += wa.startApplication;
                Application.Run(wa.fb);
            }

            public void startApplication(object sender, EventArgs e)
            {
                fm = new FormMain();
                fm.onClick += new EventHandler(fm_onClick);
                fm.Show();
                fm.BringToFront();
            }

            void fm_onClick(object sender, EventArgs e)
            {
                fs = new FormSecond();
                fs.Show();
                fs.BringToFront();
                fm.Close();        
            }
        }
    }

    Code Block

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace DesdeCero
    {
        public partial class FormMain : Form
        {
            public event EventHandler onClick;
            public FormMain()
            {
                InitializeComponent();
            }

            private void button_Click(object sender, EventArgs e)
            {
                this.onClick(this, null);
            }
        }
    }

    Code Block

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace DesdeCero
    {
        public partial class FormSecond : Form
        {
            public event EventHandler onClick;
            public FormSecond()
            {
                InitializeComponent();
                this.BackColor = Color.Turquoise;
            }
        }
    }


    Thank you so much, I'm still learning C#...
    Thursday, January 10, 2008 10:45 AM
  • Hello,

     

    I suppose this all works, but isn't it strange in the first place that the bar appears in a fullscreen application?

     

    Marthijn.

    Thursday, January 10, 2008 10:57 AM
  • It seems to me it shouldn't appear, but anyway there has to be a way to force it not appear, no?
    Thursday, January 10, 2008 11:03 AM
  • To prevent the taskbar from occasionally appearing when your app is using the entire screen, you have to hide the taskbar window.  Make sure to show the taskbar again when your app closes. Here's some more explicit code, in C#, that I've been using for a few years now:

     

    [DllImport("coredll.dll")]

    extern IntPtr FindWindow(string lpClassName, string lpWindowName);

     

    [DllImport("coredll.dll")]

    extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

     

    const int SW_HIDE = 0;

    const int SW_SHOW = 5;

    const string TASKBARCLASS = "HHTaskBar";

     

    public void HideTaskBar()

    {

    IntPtr hWnd = FindWindow(TASKBARCLASS, null);

    ShowWindow(hWnd, SW_HIDE);

     

    }

    public void ShowTaskBar()

    {

    IntPtr hWnd = FindWindow(TASKBARCLASS, null);

    ShowWindow(hWnd, SW_SHOW);

    }

     

    Friday, January 11, 2008 5:00 PM
  • What you are doing is not the right way to handle taskbar for fullscreen application - Try using SHFullScreen() API

     

    Sunday, February 10, 2008 4:29 AM