🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16747

Re: WM_NCPAINT - no region to be had

#16747
From: Chris
Date: Sun, 27 Apr 2003 00:08
70 lines
3317 bytes
"JD" <nospam@nospam.com> wrote in message
news:3eab1440$1@newsgroups.borland.com...
>
> How did you remove the OldWindowProc? When I tried that the
> form never got displayed?
>

I just commented it out, I assumed that OldWindowProc is your code and of
course I did not write such a function on my test.


> >The function is called loads of times and
> >
> >HRGN hrgn = (HRGN) Message.WParam; returns :00000001
> >
> >when this happens DWORD dwCount = GetRegionData( hrgn, 0, NULL ); returns
0
> >and the main block doesn't run.
>
> Could you please be a bit more clear about what is what when?
>

I'll try;

I started a new app and dropped a label on it with it's caption set to
"label1".  I created a message map in the header and then dropped your code
snippet into the unit file.

ala;

(I've loaded a custom control since my last message and BCB4 is not working
now (Argh) so this is from your post and not the IDE but it is an accurate
reflection of what I did)

void __fastcall TForm1::NewWindowProc( TMessage& Message )
{
    //OldWindowProc( Message );    //<--- OldWindowProc is your code I
assume???????
    if( Message.Msg == WM_NCPAINT )
      {
          char *Buffer = NULL;       // <--- set breakpoint 1 here
          RGNDATA *pRgnData;
          HRGN hrgn = (HRGN) Message.WParam;
          DWORD dwCount = GetRegionData( hrgn, 0, NULL );

          if( dwCount > 0 )
            {
                Label1->Caption = "Made it to here";   //  <--- set
breakpoint 2 here
             // <snip>
            }
          if( Buffer ) delete Buffer;
      }
}

Often the app would break on BP1 even though nothing has covered the form's
border, when this is the case GetRegionData fails because hrgn is always at
00000001.

If I actually invalidated the form's border by moving it off screen, BP2
fires and now hrgn is at something like 0d0201030 (made this up but it is a
valid region handle).

So it works but I do not know why it receives so many WM_NCPAINT messages
that seem to be erroneous.

Hope this helps.

Chris
Technical Details
Message-ID: <3eab1f63@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsread.com!newsprint.netaxs.com!out.nntp.be!propagator2-sterling!in.nntp.be!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3ea8c4fd$1@newsgroups.borland.com> <3ea93062@newsgroups.borland.com> <3eaa9f2d$2@newsgroups.borland.com> <3eaadb70@newsgroups.borland.com> <3eaafbd2$1@newsgroups.borland.com> <3eab0d33@newsgroups.borland.com> <3eab1440$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,bd52d89ee166c26a
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-26 17:29:15 PST
From: "Chris" <chris@chrischfmouseyREMOVE.karoo.co.uk>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ea8c4fd$1@newsgroups.borland.com> <3ea93062@newsgroups.borland.com> <3eaa9f2d$2@newsgroups.borland.com> <3eaadb70@newsgroups.borland.com> <3eaafbd2$1@newsgroups.borland.com> <3eab0d33@newsgroups.borland.com> <3eab1440$1@newsgroups.borland.com>
Subject: Re: WM_NCPAINT - no region to be had
Date: Sun, 27 Apr 2003 01:08:01 +0100
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 212.50.170.106
Message-ID: <3eab1f63@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1051402083 212.50.170.106 (26 Apr 2003 17:08:03 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsread.com!newsprint.netaxs.com!out.nntp.be!propagator2-sterling!in.nntp.be!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail