Solved

Removing a window's button from the taskbar

Posted on 2000-03-03
10
247 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
  • 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

839 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