Article View: borland.public.cppbuilder.nativeapi
Article #12839Re: GDI Objects build up using CreateCompatibleDC and CreateCompatibleBitmap
From: Remy Lebeau (TeamB)
Date: Sun, 16 Nov 2003 11:06
Date: Sun, 16 Nov 2003 11:06
22 lines
1626 bytes
1626 bytes
"LarryJ" <LarryJ33@ev1.net> wrote in message
news:3fb7541b$1@newsgroups.borland.com...
> DeleteDC(hDC1);
> delete PCForm->BGCanvas;
You need to swap those lines around. During the TCanvas's destruction, it
accessing the HDC that it is associated with. But you are freeing the HDC
beforehand, so the TCanvas won't be able to free its internal resources
correctly.
> hDC1 = CreateCompatibleDC(PCForm->Canvas->Handle);
> hBMP1 = CreateCompatibleBitmap(PCForm->Canvas->Handle,
You should be passing the new HDC, not the original HDC, as the first
parameter to CreateCompatibleBitmap(), ie:
hBMP1 = CreateCompatibleBitmap(hDC1, ...);
Gambit
Technical Details
Message-ID:
<3fb75960$1@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-mailReferences:
<3fb7541b$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,17187dcae4d9769f,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-16 03:09:15 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3fb7541b$1@newsgroups.borland.com> Subject: Re: GDI Objects build up using CreateCompatibleDC and CreateCompatibleBitmap Date: Sun, 16 Nov 2003 03:06:37 -0800 Lines: 24 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: 67.22.137.149 Message-ID: <3fb75960$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1068980576 67.22.137.149 (16 Nov 2003 03:02:56 -0700) 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