Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: GDI+ C++/MFC
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
mr.dot530
Edited 9-Feb-11 18:36pm
TweakBird17.1K
Rate this: bad
good
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).
  Permalink  
v2
Comments
mr.dot at 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]);
DeleteObject(hBitmap[i]);
}
 
Gdiplus::GdiplusShutdown(dwToken);
return 0;
}

 
And I found that it's SelectActiveFrame.
Nishant Sivakumar at 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 at 10-Feb-11 17:39pm
   
See http://support.microsoft.com/kb/971389 for more info.
mr.dot at 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 at 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.
mr.dot at 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 at 10-Feb-11 22:49pm
   
Good luck!
mr.dot at 24-Feb-11 7:16am
   
Hi, Nish, I have post this issue to Connect.
But it's still not solved.
 
The URL is:
https://connect.microsoft.com/VisualStudio/feedback/details/642663/gdiplus-access-violation
Espen Harlinn at 10-Feb-11 17:31pm
   
Good effort, a 5
Nishant Sivakumar at 10-Feb-11 17:37pm
   
Thanks Espen.
Rate this: bad
good
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+[^]
 
Regards
Espen Harlinn
  Permalink  
Comments
mr.dot at 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
0 OriginalGriff 350
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 Sergey Alexandrovich Kryukov 130
4 DamithSL 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,310


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 10 Feb 2011
Copyright © CodeProject, 1999-2014
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