Solved

Overriding Nonclient window area

Posted on 2001-08-17
3
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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.  …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

707 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