Article View: borland.public.cppbuilder.nativeapi
Article #2099Re: Bitmap GetObject
From: Bob Gonder
Date: Thu, 05 Apr 2007 14:05
Date: Thu, 05 Apr 2007 14:05
25 lines
1681 bytes
1681 bytes
poojo hackma wrote:
>void CForm1Dlg::OnPaint()
>{
> BITMAP BMP;
24 bytes of data
> // Help says if I pass NULL as param2, GetObject returns the
> // size needed to allocate for the bitmap object:
> ok = bitmap.GetObject(sizeof(BITMAP), NULL);
> // problem is, GetObject above always returns ok=84.
> // Any idea what that would mean?
It means you nead an 84 byte data area for the object.
> // In the GetObject below, if hBMP is to a JPEG file,
> // other areas of my application get overwritten.
> // Does anyone know why?
> ok = bitmap.GetObject(ok, &BMP);
You just wrote 84 bytes of data to an area that is 24 bytes in size.
The reason you call it with NULL in the first place, is to allocate
enough space for the real call, but you never do that.
Technical Details
Message-ID:
<840a13tv68iop0hgv2keepb1bcrcg5btk9@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4613f4bc@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,cc67b7c92694fec8 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Bitmap GetObject Date: Thu, 05 Apr 2007 07:05:07 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <840a13tv68iop0hgv2keepb1bcrcg5btk9@4ax.com> References: <4613f4bc@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.69.88.109 X-Trace: newsgroups.borland.com 1175781905 69.69.88.109 (5 Apr 2007 07:05:05 -0800) Lines: 27 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail