API

hi everybody i have 3 question :
1) how can i hide a program (win32) from taskbar(just taskbar)
2) how can i hide or remove or disable close button (x) from console windows
3) how can i put my window in TOPMOST level . ofcourse showwindow doesnt have parameter to do topmost
tnx
Last edited on
We need to know the target platform for some of these answers. So which version of Windows?

EDIT:
1) Services can have windows that interact with the user but do not necessarily draw the "bubbles" on the task bar.

2) CS_NOCLOSE... This question makes me think you're being lazy about this.

3) This is where I would need to know the Windows version. If you mean one of those security warnings in Vista\7 I would have to do some research myself.
Last edited on
1) It is controled by the window style.
2) I have no idea. Seems that Computergeek01 knew, so phew! hehe
3) Use SetWindowPos() with HWND_TOPMOST.

If you need help with window styles or SetWindowPos(), browse the Net. Plenty of info about this out there.
in windows XP with visual studio 2008 or 2010
ok i understand with setwindowpos() can set to topmost but question 1 and 2 .... i cant understand your means ? please guide me more.
how can i hide in taskbar
and disable close button
The "style" property in the WNDCLASSEX struct is where you designate the 'CS_NOCLOSE' property. webJose says that this property would also allow you to draw a window without having to render it on the taskbar but I'm not sure how to do it this way. I'd honestly go with his method of hidding the window because writing this as a class service just so that it doesn't draw a bubble on the bottom of the screen is a little too much work.
Last edited on
If you are using CreateWindow() to create your main window, then change it to CreateWindowEx() and pass WS_EX_TOOLWINDOW as extended style. This will make the window disappear from the taskbar. I just tested it to be sure. It works but it has a side effect: The window caption is smaller.

If you cannot live with a smaller window caption, you'll have to obtain the corresponding TaskbarList COM object and delete the taskbar tab this way. See http://msdn.microsoft.com/en-us/library/bb774652(VS.85).aspx for the COM interface. You'll find examples in the web where the interface is defined by them as opposed to just including the appropriate header. Include the header and don't define the interface yourself.

If you are not familiar with COM, then just try to follow an example in the web. One is here: http://www.codeproject.com/KB/dialog/hidetaskbar.aspx .
FYI, I just did the TaskbarList object exercise and I had to remove #define WIN32_LEAN_AND_MEAN out of my precompiled header. If left in there, the #inclusion of Shobjidl.h fails (for the interface definition and GUID's).
ahura24 - did you really mean a console window? (for 2)

Computergeek - I've never removed the close button from a console window. Where to you get at it's WNDCLASSEX?

There is a Microsoft Knowledgebase article describing how to (almost) do this, but in VB :-(

How to disable the Close button on the title bar of a console application by using Visual Basic 2005 or Visual Basic .NET
http://support.microsoft.com/kb/818361
Last edited on
how can i hide a program (win32) from taskbar(just taskbar)

wasn't it:
 
ShowWindow (hwnd, SW_HIDE);
tnx a lot . yes i need in console window . i know i can with "allocConsole" can create a new console but i dont know how can i disable ControlBox in in window(console form) . very very tnx guys. if find other solution please put for me in this thread :D
You can also "disable" the X in the top right corner by catching the WM_QUIT message in your wndproc Callback loop for that class.

EDIT: You would then just return from that message instead of letting the default case take care of it.
Last edited on
If you want a console app, I would go with an actual console app, rather than a windows app which allocates it's own console. kb818361 does look like it explains bow to disable the close button.

If you do go with the AllocConsole route, and want to use cout, etc, you'll have to add initialization code to hook the iostream libraries yourself.

If you want to remove the console window (which is hosting your console app) from the task bar, that will probably need a bit more care than removal of a normal app.

Andy
Last edited on
Topic archived. No new replies allowed.