Solved

Overriding Nonclient window area

Posted on 2001-08-17
3
307 Views
Last Modified: 2013-12-03
Hello all,

(Working in VC++ 6.0 in Win98 using Win32 *NOT* MFC)

I'm trying to make a window that overrides all of the default nonclient window painting--I don't want windows to ever paint any part of my window using any default functions.  I want to retain the functions of the close box, the maximize box, minimize, and system menu, but I want to, for example, draw my caption bar, my window borders, my close box, min/max boxes, etc.
     I tried overriding WM_NCPAINT and several other NC messages, but for some reason various window parts are painted anyways, but only at specific times.  Such as, the close box and min/max boxes along with their little borders that are part of the caption bar, are painted when I position my mouse over the sizable borders of the window.  Another thing is that whenever, due to programmatic error, my program goes into an infinite loop and disallows my WM_NCPAINT function to be performed, Windows paints my caption bar when the window goes inactive.
     I would appreciate source code that will work, because I have been pulling my hair out playing around with various attempts to accomplish this.  MSDN isn't much help because Microsoft is under the impression that you don't need to override the drawing of these things because that would make the user interface of Windows nonstandard, and therefore make it not user-friendly--I don't care.

Thanks,
  Jared
0
Comment
Question by:Rauros
3 Comments
 
LVL 15

Accepted Solution

by:
NickRepin earned 300 total points
ID: 6398879
It is impossible to override all NC painting, it is by Windows design. Create a window without NC area (no borders, no title) and 'simulate' the NC area yourself.
0
 
LVL 5

Expert Comment

by:robpitt
ID: 6399890
Windows seems to cheat and directly paint parts of the nonclient area rather than working exclusively throught the WM_NCPAINT messages as it should.

This cheating makes it pretty difficult to reliably customise NC painting. In particular windows seems to directly paint the caption buttons and part of the gradient caption.

Then just to complicate matters the next Windows (Windows XP) includes a completely style for windows i.e. a new non-client drawing style.

0
 

Expert Comment

by:bighead1997
ID: 6406530
i think NickRepin is right.
you create a window without border,then draw it out (include the close box...),when user click it ,simulate a
WM_SYSCOMMAND message ,let window handle it
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now