🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Lots of data

#12064
From: Ed Mulroy [TeamB]
Date: Thu, 01 Jan 2004 17:28
42 lines
2906 bytes
Your code shows that you already know how to create a compatible DC.

Create a bitmap compatible with the HDC of the client area on the screen.
Call GetClientRect to get the dimensions of that client area and use
CreateCompatibleBitmap to get a bitmap sized for the screen.

Keep the bitmap around as long as the window is not resized.
When a WM_SIZE is received and the client area has changed then create
a new bitmap, erase it and BitBlt to it from the old client bitmap, ending
by
deleting the old bitmap.

The response to any WM_PAINT message should be simple.  BeginPaint, BitBlt
the client bitmap to the screen, EndPaint and return 0.  The multiple slow
operations of painting each of the elements to the screen each time a paint
message has been received is replaced by doing that to the client bitmap
only once.

Note that the memory DC associated with the client bitmap and the client
bitmap itself should be saved in a static variable (or a global one although
that is less desirable) so that it persists across multiple calls to the
window procedure.  Both that DC and the client bitmap should be deleted in
response to the WM_DESTROY message.

I don't know what OpenGL or DirectX do.  They kept releasing different
versions which, at least in the beginning, had serious issues of compatabity
between versions and often were only partially supported on the user
machines.  I gave up on following their rocky learning curve.  Things are
undoubtedly better with them these days.

.  Ed

> M. Finch wrote in message
> news:3ff44fe4$1@newsgroups.borland.com...
>
> Sounds like an excellent idea.  I don't know how to do that.  Can
> you point me in the right direction?
>
> Does that mean to create a secondary DC, write to that,  then Blit
> it to the screen?  That or set up some kind of double buffering.  I
> figured that is what DirectX and OpenGL do.  I don't know how to
> do that with API.
Technical Details
Message-ID: <3ff458ce@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3ff41d43$1@newsgroups.borland.com> <3ff421ca$1@newsgroups.borland.com> <3ff44fe4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,894ad098f15950e6
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-01 09:39:30 PST
From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ff41d43$1@newsgroups.borland.com> <3ff421ca$1@newsgroups.borland.com> <3ff44fe4$1@newsgroups.borland.com>
Subject: Re: Lots of data
Date: Thu, 1 Jan 2004 12:28:45 -0500
Lines: 44
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.1106
NNTP-Posting-Host: 24.74.175.102
Message-ID: <3ff458ce@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1072978126 24.74.175.102 (1 Jan 2004 09:28:46 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail