• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 530
  • Last Modified:

Hide Icon of Windows Form

Hello
In my Windows.Forms application I open a seperat Dialog "myTitel", which presents the Titlebar of my app. I set the property ShowInTaskbar = false;
There is no Icon in the Taskbar, but when I press Alt+Tab to switch between applications, I still have the the Dialog as an icon.
How can I hide it there aswell?

My application is still on .NET 1.1
0
ICSAutomation
Asked:
ICSAutomation
2 Solutions
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Just set the extended window style WS_EX_TOOLWINDOW in CreateParams:
public partial class myTitle : Form
    {

        public myTitle()
        {
            InitializeComponent();
            this.ShowInTaskbar = false;
        }

        private const int WS_EX_TOOLWINDOW = 0x80;

        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= WS_EX_TOOLWINDOW;
                return cp;
            }
        }

    }

Open in new window

0
 
cresttyCommented:
Hiding an application in Taskbar will not hide the Window. If you hide the Window it should not show up in the ALT+TAB List.

Try this: http://msdn.microsoft.com/en-us/library/system.windows.window.hide.aspx

You will have to control the State of the Window then ... perhaps have the application in the System Tray
and have the application hide and show when the tray icon is clicked.

"If you do not want the application to be visible at all, consider creating a service instead."
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now