Solved

Overriding Nonclient window area

Posted on 2001-08-17
3
311 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 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