Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need top-level WS_OVERLAPPED but no CAPTION window (or any NC area)

330 views
Skip to first unread message

Mike Oliver

unread,
Oct 8, 2001, 5:26:20 PM10/8/01
to
I want to create a top-level window that I can paint whatever I want into
it. Should be simple, eh? Here is the issue. Normally, I would use the
WS_POPUP style (as almost every code out there that tries to do this uses).
The problem with WS_POPUP is that the what shows up on the TASK BAR (not
talking about system tray) is not what the user expects. There is no icon w/
the "button" that is placed on the task bar - just text - which looks
ugly/unprofessional. I want my icon to show.

The only way to get the icon to show in the task bar, it seems, is to use
WS_OVERLAPPED / WS_OVERLAPPEDWINDOW. The problem, then, however, is that I
get a caption and system menu. What I'd like to do is shrink this NC area
down to 0,0 so that even though it "exists", Windows never paints anything
and I have the entire window area as my client area. Make sense?

My problem is that going down this approach, I'm having difficulty w/
setting the NC area to 0,0. In some cases, activations, etc., I'm still
getting Windows trying to paint a caption there.

Some examples of what I'm trying to create: Outlook "notes", WinAmp main
window, etc... All of these are WS_OVERLAPPED windows so somehow they are
dealing with getting rid of the captions.

Would apprecate any help - down the direction I've taken, or other
suggestions, code samples. I'm an expert Windows programmer, but I'm getting
stumped on this one ;)

Regards,

Mike Oliver
Invertix


Thomas Jongepier

unread,
Oct 9, 2001, 4:48:57 AM10/9/01
to
Try experimenting with CWindowDC instead CPaintDC in OnPaint( ). I used it
in an occasion, but i had a background bitmap covering the whole area.
Another experiment you might try is to use OnNcPaint to paint the NC area in
a certain color (for example the color of the client area.). Override the
OnNcActivate(..) function and let that return FALSE.
Also remove the caption and sysmenu etc.: ModifyStyle(WS_OVERLAPPEDWINDOW,
0 );

good luck

Thomas


"Mike Oliver" <mol...@invertix.com> schreef in bericht
news:eu9SZBEUBHA.2220@tkmsftngp05...

wl...@nospam.com

unread,
Oct 9, 2001, 12:04:27 PM10/9/01
to
If you use SetWindowRgn instead of just the styles meant for modal pop-ups,
about boxes and what not you can set the window styles to anything you want,
including WS_OVERLAPPEDWINDOW. This results in a custom drawn window with
an icon in the taskbar.

If you figure out how to tell Windows what the non-client and client region
of the windows are, please let me know, that part I don't know and the code
I've seen for doing this leaves the standard non-client and client areas,
though you can override the drawing for them.... But I (and probably you)
would like to just have one big client area...

Please post back if you figure this out.

"Mike Oliver" <mol...@invertix.com> wrote in message
news:eu9SZBEUBHA.2220@tkmsftngp05...

Mike Oliver

unread,
Oct 9, 2001, 12:36:05 PM10/9/01
to
Thanks for the response. If you do this:

void CMainFrame::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR*
lpncsp)
{
// do nothing - will cause window rect to equal client rect, no room left
for NC area
}

trap the WM_NCCALCSIZE message to prevent Windows from re-sizing the client
area to make room for the NC area, you can get 3/4 the way there. The
problem is that there are a whole host of "back-door" mechanisms whereby
Windows ignores the NC area and tries to paint the caption anyways!

Mike

<wl...@nospam.com> wrote in message news:9pv75l$pk0$1...@bob.news.rcn.net...

Benoit F

unread,
Oct 9, 2001, 3:34:01 PM10/9/01
to
When the system draw the caption bar, it draws on the window DC (witch is an
area that covers the entire window). So, even if you set the NC area to
(0,0), the system is going to draw the caption bar over the client area.

What you have to do is to catch the WM_NCPAINT message and return TRUE. This
way, the system will not draw anything.

-----------------------------------------------------------


"Mike Oliver" <mol...@invertix.com> wrote in message
news:eu9SZBEUBHA.2220@tkmsftngp05...

Chris Becke

unread,
Oct 9, 2001, 5:38:05 PM10/9/01
to

"Mike Oliver" <mol...@invertix.com> wrote in message
news:eu9SZBEUBHA.2220@tkmsftngp05...
> I want to create a top-level window that I can paint whatever I want into
> it. Should be simple, eh? Here is the issue. Normally, I would use the
> WS_POPUP style (as almost every code out there that tries to do this
uses).
> The problem with WS_POPUP is that the what shows up on the TASK BAR (not
> talking about system tray) is not what the user expects. There is no icon
w/
> the "button" that is placed on the task bar - just text - which looks
> ugly/unprofessional. I want my icon to show.

errr, try WS_POPUP|WS_SYSMENU

This style combo on Win2K at least results in a captionless borderless
window with a icon on the taskbar.

.Chris


0 new messages