Solved

Overriding Nonclient window area

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 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

19 Experts available now in Live!

Get 1:1 Help Now