If you have a form application and open another form from a buttoncontrol on "Form1", this will open another form but this form will also be in the "Taskbar" on your desktop. So you have 2 forms in the "Taskbar" (What I am after is to still only have one wich is the "Form1".
When using other windowsprograms and open forms like this, the form shows but not in the "Taskbar".
I use this code to open a form.
Is this possible to do and is it difficult ?

private: Form2 form2instance;

this->form2instance.ShowDialog();

The typical way to handle this is to create a hidden parent window for the whole application. All other top-level windows are children of this parent window, so no extra taskbar buttons are created for them.

To quote the MS docs under Visibility of Taskbar Buttons

A taskbar button is placed on the taskbar whenever an application creates a unowned primary window. To ensure that the window button is placed on the taskbar, create the window by calling CreateWindowEx and include the WS_EX_APPWINDOW style. To prevent the window button from being placed on the taskbar, create the window by calling CreateWindowEx and include the WS_EX_TOOLWINDOW style. As an alternative, you can create a hidden window and make it the owner of your primary window.

The window button typically contains the application icon and title. However, if the application does not contain a window menu, the window button is created without the icon.

If you want your application to display a message to the user while its window is not active, use the FlashWindow function to let the user know that a message is waiting. This function flashes the window button. Once the user clicks the window button to activate the window, your application can display the message.

Hope this helps.

Okay, it sounds interesting. Is there any topic on this on msdn ?

It is hard to understand how this is done. I have 2 forms. 1 that opens up first and 2:nd that I open from this form. (So Form1 and Form2)

Does this meen that I will do one more form that is the parent Form and my Form1 and Form2 will be children to that one ?

Yes, essentially.

I'm surprised your IDE doesn't do this for you already. What are you using? VC++? BC++Builder?

Yes I am using VC++ 2008 Express Edition. Should it do this automatically. Perheps there is any settings in VC++ to do to make it work automatically ?

Yes, essentially.

I'm surprised your IDE doesn't do this for you already. What are you using? VC++? BC++Builder?

I have no clue about VC++. You should have started a "Windows Application" project, and AFAIK that should have done it for you...

VC++ 2008 EE gives you the option under properties of the form - Window Style - ShowInTaskbar. Set it to false.

I realise the thread is a bit outdated, but it's something I hadn't considered.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.