Click here to Skip to main content
13,342,925 members (57,570 online)
Click here to Skip to main content
Add your own
alternative version


28 bookmarked
Posted 28 Apr 2007

Hiding the Caption and Icon in the Title Bar in Windows Vista

, 28 Apr 2007
Rate this:
Please Sign up or sign in to vote.
Prevent the Caption and Icon from appearing in the Title Bar, while still appearing in the Task bar, like Windows Explorer

Screenshot - hide.png


Ever noticed in Windows Explorer (My Computer) that the Caption (Title Bar Text) and Icon are not displayed? Ever wondered how to do it in your program?
This Guide Will Show You How.


Say you have extended the Glass Effects a bit further (like in the example) and then have put a larger, easier to read title there, or perhaps a logo instead. Or as in Explorer you have what is usually in the title available just a bit further down. For example, this is the same as the screenshot above, but with the Caption visible:

Screenshot - nohide.png

It seems kind of pointless doesn't it? You may go as far to say it looks very unprofessional. Well, Vista has functions that enable you to hide the Caption and Icon, the best thing about using these is that the caption still appears in the task bar at the bottom. If you tried to remove it by blanking out the .Text property, the caption would disappear in the task bar, which will lead to confusion.

Using the code

Unfortunately there is no way to set the properties we want in Managed code, so we have to call Native "Unmanaged" Code to hide it. Luckily its not too hard to move over and it works perfectly. To Use it, you must first fill in an WTA_OPTIONS struct, which contains what you want to remove, and then you must call the function.

// We Want To Hide the Caption and the Icon
// If we set the Mask to the same value as the Flags, the Flags are Added. 
// If not they are Removed
// Set It, The Marshal.Sizeof() stuff is to get the right size of the 
// custom struct, and in UINT/DWORD Form
        ref ops,

I provided in the Code all four Flags that Microsoft documented, although you will probably only use the first two. If you don't understand the line:


Don't Worry, its just to get the right memory size for the Structure. You will never need to change it even if you change the flags.

Points of Interest

Writing this code helped me realise just how easy it was to use native code in C#. Finding out the function to use took a lot longer than writing it!

The uints everywhere are C# closest match to DWORD, which is what the documentation specifies as the top.

For some reason, Microsoft made the AttributeType an enum, although at the moment there is only one value, WTA_NONCLIENT or 1. I kept it as an enum for consistency with the native code.

In the download, I also included the DWM Code to extend margins, because it works well with this, and is not that hard to do. I didn't write it, but I saw it on numerous sites so I can't remember who to credit. Sorry!


  • 1.0 - First Revision


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Nic Hubbard
United Kingdom United Kingdom
Astrophysics student with an enjoyment of programming.
Currently experimenting with emulation in C++, and
experimenting with assembly (ARM and x86)

You may also be interested in...

Comments and Discussions

QuestionHow do I hide the caption and icon in VB.NET? Pin
Member 867663815-Jul-12 0:16
memberMember 867663815-Jul-12 0:16 
QuestionThe download source and binaries link is broken Pin
Dominic He3-May-12 22:44
memberDominic He3-May-12 22:44 
Generalinterestingly this still leaves the icon's context menu enabled Pin
Patrick Klug14-Mar-10 19:12
memberPatrick Klug14-Mar-10 19:12 
GeneralGreat Pin
pimb225-Jul-09 0:32
memberpimb225-Jul-09 0:32 
QuestionNeat, but how about hiding title bar altogether? Pin
logan133721-Nov-07 15:56
memberlogan133721-Nov-07 15:56 
AnswerRe: Neat, but how about hiding title bar altogether? Pin
logan133721-Nov-07 17:38
memberlogan133721-Nov-07 17:38 
QuestionWhat about WPF Pin
SveFro29-Jul-07 6:04
memberSveFro29-Jul-07 6:04 
AnswerRe: What about WPF Pin
apoll022-Nov-09 9:55
memberapoll022-Nov-09 9:55 
GeneralThank you - this is what I am looking for Pin
a-chih14-Jun-07 9:27
membera-chih14-Jun-07 9:27 
GeneralI prefer to enable them back in the explorer Pin
davepermen28-Apr-07 5:59
memberdavepermen28-Apr-07 5:59 
GeneralRe: I prefer to enable them back in the explorer Pin
Nic Hubbard28-Apr-07 6:55
memberNic Hubbard28-Apr-07 6:55 
GeneralRe: I prefer to enable them back in the explorer Pin
davepermen28-Apr-07 7:05
memberdavepermen28-Apr-07 7:05 
GeneralRe: I prefer to enable them back in the explorer Pin
Nic Hubbard28-Apr-07 9:50
memberNic Hubbard28-Apr-07 9:50 
GeneralRe: I prefer to enable them back in the explorer Pin
robertw01928-Apr-07 11:06
memberrobertw01928-Apr-07 11:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 28 Apr 2007
Article Copyright 2007 by Nic Hubbard
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid