🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: WM_NCPAINT - no region to be had

#16739
From: JD
Date: Sat, 26 Apr 2003 15:01
39 lines
2384 bytes
"Ed Mulroy [TeamB]" <ed@mulroyREMOVETHESECHARS.org> wrote:
> When you receive the WM_NCPAINT message the wParam argument
> is a handle to the region to be painted. All non-client paint
> messages give you a rectangular region and a call to GetRegionData
> can be used to find the rectangular coordinates [...]

I tried to GetRegionData but there's never anything there which
I know is not the case so my code must be in error. Can you
tell me what I'm doing wrong please?

~ JD
 

void __fastcall TForm1::NewWindowProc( TMessage& Message )
{
    OldWindowProc( Message );
    if( Message.Msg == WM_NCPAINT )
      {
          char *Buffer = NULL;
          RGNDATA *pRgnData;
          HRGN hrgn = (HRGN) Message.WParam;
          DWORD dwCount = GetRegionData( hrgn, 0, NULL );

          if( dwCount > 0 )
            {
                Label1->Caption = "Made it to here";
                Buffer = new char[ dwCount ];
                pRgnData = reinterpret_cast<RGNDATA*>( Buffer );
                GetRegionData( hrgn, dwCount, pRgnData );
                RECT *R = reinterpret_cast<RECT*>(pRgnData + sizeof( RGNDATAHEADER ));
                for(unsigned int x = 0; x < pRgnData->rdh.nCount; x++, R++)
                  {
                      // fill the rect ( R ) for visual confirmation
                  }
            }
          if( Buffer ) delete Buffer;
      }
}
Technical Details
Message-ID: <3eaa9f2d$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!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>

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 08:04:50 PST
From: "JD" <nospam@nospam.com>
Sender: "JD" <nospam@nospam.com>
Reply-To: "JD" <nospam@nospam.com>
Subject: Re: WM_NCPAINT - no region to be had
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 172.171.199.38 172.171.199.38    
References: <3ea8c4fd$1@newsgroups.borland.com> <3ea93062@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3eaa9f2d$2@newsgroups.borland.com>
Date: 26 Apr 2003 08:01:01 -0700
X-Trace: newsgroups.borland.com 1051369261 207.105.83.65 (26 Apr 2003 08:01:01 -0700)
Lines: 40
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!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