Click here to Skip to main content
11,925,006 members (46,985 online)
Rate this:
Please Sign up or sign in to vote.
See more: MFC GDI+
I use GDI+ in my MFC Application.
When I debug it, the output window of VS2008 displays the below information:

First-chance exception at 0x4aee65a7 (GdiPlus.dll) in SkinMgr.exe: 0xC0000005: Access violation writing location 0x014a1044

Such messages fulfills the output window, but it runs well in Debug version as well as Release version.

I noticed that such warnings happen in Gdiplus::Bitmap::SelectActiveFrame and Gdiplus::Bitmap::GetHBitmap.

I don't know whether it's a potential error.
Did anyone has encountered such problem?
Appreciated for any help or tips.
Posted 9-Feb-11 17:06pm
Edited 9-Feb-11 18:36pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

GDI+ has been known to have quite a few bugs although many of those have been fixed (or even hotfixed) by now. That said, this may not be a GDI+ issue but an issue in a 3rd party component you are using (perhaps for skinning, based on the name of the exe). It's certainly not a good thing but it's also possible that these errors won't directly affect program behavior.

Worst case scenario is it's a problem in your code, in which case you should try and isolate out some minimal code that reproduces this problem. That may help you identify whether it's something you can fix or if it's something happening deep within GDI+ (in which case you may want to report it to Microsoft via Connect).
Comments 10-Feb-11 0:30am
Thanks, Nish.
I wrote one simplest demo which can demonstrate this problem:

int _tmain(int argc, _TCHAR* argv[])
ULONG_PTR dwToken = 0;
Gdiplus::GdiplusStartupInput _input;
Gdiplus::GdiplusStartup(&dwToken, &_input, NULL);

GUID pageGuid = Gdiplus::FrameDimensionTime;

HBITMAP hBitmap[10] = {0};
Bitmap* pBitmap = Bitmap::FromFile(_T("D:\\Projects\\SkinMgr\\Image\\checkingassist.gif"));

for(int i=0; i<10; ++ i)
pBitmap->SelectActiveFrame(&pageGuid, i);
pBitmap->GetHBITMAP(Color(0, 0, 0, 0), &hBitmap[i]);

return 0;

And I found that it's SelectActiveFrame.
Nishant Sivakumar 10-Feb-11 17:36pm
Ok, I believe this is a known bug in GDI+ when dealing with gif files. There is a Hotfix for it too.
Nishant Sivakumar 10-Feb-11 17:39pm
See for more info. 10-Feb-11 21:16pm
Thanks Nish.
I knew this article, and it's target OS is MS Vista or MS 2008 while I'm working on Windows XP.
And you know, we can't force users to install this hotfix for our software.

I'll post this problem to Connect, and wish MS could give one way out.

In fact, all programs I worked on has this problem, which of them are used by lots customers, and no one report anything about this.
Nishant Sivakumar 10-Feb-11 22:06pm
Yeah, I know. GDI+ is a lot of hassle (although it's also a big time saver). Try posting on Connect and give them your minimal repro project, that would be a good next step for you. 10-Feb-11 22:48pm
Got it, and I'll try.
Thanks a lot.
If I get useful information, I'll let you know.
Nishant Sivakumar 10-Feb-11 22:49pm
Good luck! 24-Feb-11 7:16am
Hi, Nish, I have post this issue to Connect.
But it's still not solved.

The URL is:
Espen Harlinn 10-Feb-11 17:31pm
Good effort, a 5
Nishant Sivakumar 10-Feb-11 17:37pm
Thanks Espen.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Not sure what's wrong with your code, but you may find this article helpful:
Adding GIF-animation using GDI+[^]

Espen Harlinn
Comments 11-Feb-11 1:45am
Thanks Espen.
I have read that article, that doesn't work on this issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151125.3 | Last Updated 10 Feb 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100