🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #3089

Rectangle tooo slow?

#3089
From: David T Mitchell III
Date: Mon, 03 Jun 1991 14:08
29 lines
1596 bytes
I want to make my winapp's border non-standard colors (ie, active
and inactive border colors != COLOR_ACTIVEBORDER, COLOR_INACTIVEBORDER).

It appears that to process WM_NCPAINT, it's all or nothing (is this true?),
so I decided to be Q&D about it...
	.
	.
	case WM_NCPAINT:
	    DefWindowProc(hwnd, msg, wParam, lParam);	// draw the window
	    ExcludeClipRect(hdc, {everything inside the borders});
	    SelectObject(hdc, CreateSolidBrush(myColor));
	    Rectangle(hdc, 1, 1, {full window extents});
	    return 0L;

This works just dandy (left out details about checking for type of border,
etc, for clarity), HOWEVER it's suprisingly slow!  Stepping through with the
debugger I find that calling DefWindowProc paints the entire window frame
with border BANG!, but Rectangle() paints so slowly that you first see the
standard borders, then the new color flowing down over.

I tried using 4 seperate rectangle calls (as opposed to excluding & 1 call),
but that just gives the same results, but with 4 slow rectangles.

Why is the DefWindowProc so much faster than a simple Rectangle?  Is there
a better way (read: faster) to do this?

thanks in advance, 

dave	dave@wucs1.wustl.edu
Technical Details
Message-ID: <1991Jun3.140840.26667@cec1.wustl.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!cec2!news

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!cec2!news
From: dave@wucs1.wustl.edu (David T Mitchell III)
Newsgroups: comp.windows.ms.programmer
Subject: Rectangle tooo slow?
Message-ID: <1991Jun3.140840.26667@cec1.wustl.edu>
Date: 3 Jun 91 14:08:40 GMT
Organization: Washington University, St. Louis MO
Lines: 29