Solved

Removing a window's button from the taskbar

Posted on 2000-03-03
10
260 Views
Last Modified: 2010-05-18
Hi, i need to remove the button of a window from a taskbar (however the window should stay visible, i'm not aiming to hide the window) what i need is a window that i will control with an icon from the taskbar only (already did that) all i need is to hide it's button from the taskbar, thanks
0
Comment
Question by:narcotic030200
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 30 total points
ID: 2581147
The rules the taskbar uses to decide whether a button should be shown for a window are really quite simple, but are not well documented. When you create a window, the taskbar examines the window's extended style to see if either the WS_EX_APPWINDOW (defined as 0x00040000) or WS_EX_TOOLWINDOW (defined as 0x00000080) style is turned on. If WS_EX_APPWINDOW is turned on, the taskbar shows a button for the window, and if WS_EX_ TOOLWINDOW is turned on, the taskbar does not show a button for the window. You should never create a window that has both of these extended styles.

You can create a window that doesn't have either of these styles. If a window has neither style, the taskbar decides to create a button if the window is unowned and does not create a button if the window is owned.

********************

So you can specify the WS_EX_TOOLWINDOW, however the problem with this is that it gives the window a smaller caption than a "regular" window.  If you don't wnat that there is a work around.  You create the window without the WS_EX_TOOLWINDOW but you create the window as an owned window.  If you do that the owner window will appear in the task bar, not this owned window.  Not much of a improvement?  Well what you do is hide the owner window, then it doesn't show in the task bar and the window that it owns, which is visible is also not shown.
0
 
LVL 1

Author Comment

by:narcotic030200
ID: 2581212
Ok, so basically what you're saying is, even if my window is it's own owner, i'll have to create another window before it and set that to be the owner?
no other way?!
0
 
LVL 22

Expert Comment

by:nietod
ID: 2581270
>>  even if my window is it's own owner,
It can't be its own owner.

Yes, you make another window to own the "real" window  and you hide this owner window.  The owner window can be VERY basic.  The window procedure can just pass everything to the default window procedure.

>> no other way?!
The easiest way is to use the tool window style.  but they you have the small caption.  You might not want that small caption, then again you might.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:narcotic030200
ID: 2581286
Ok thank you, i will try creating a window that will shadow the real one...
0
 
LVL 22

Expert Comment

by:nietod
ID: 2581333
Why "shadow"  Just create it hidden and don't worry about it again--intil the program quits, close it when it quits.
0
 
LVL 1

Author Comment

by:narcotic030200
ID: 2581347
It's not really working, i created a Dialog box and called it CMainDlg
now when my app starts, instead of letting it create the original window, i told it to create this one (which is hidden) then on the initialization of this one, i created my original window

CTestDlg dlg;
dlg.DoModal();

and it is still showing in the taskbar... :\
0
 
LVL 22

Expert Comment

by:nietod
ID: 2581442
Is the dialog owned by the hidden window?
0
 
LVL 1

Author Comment

by:narcotic030200
ID: 2581715
Yes i tried

CTestDlg dlg(this);
dlg.DoModal();

where this is the hidden window, and it still didn't work
0
 
LVL 22

Expert Comment

by:nietod
ID: 2582959
I don't know MFC so I don't know what sort of fooling around it might be doing. Did you check that the window created has the proper owner window.  (Use Spy++)  Did you check that the owner is hidden?  Did you check that the owned window (the visible one) does not have the WS_EX_APPWINDOW style?
0
 
LVL 1

Author Comment

by:narcotic030200
ID: 2583153
I don't know man, i got lost, i had created an app, it had 1 dialog box (it's the one i'm trying to make disappear) so i added 2 others, made one of them start off and call the main one as it's child, but that one was always having its button in the taskbar, so i tried the other one i added, and it worked with it, i couldn't figure it out, as much as i got frustrated, i re-wrote my code in the other dialog boxe's files, and now it's working :) so basically what you told me is right, but there was some tiny thing that i missed in the code i guess...
Thank you
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question