Solved

Overriding Nonclient window area

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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…

810 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