Hi,
Finally I was able to succefuly use GDI + in VC++ 6.0 .
i needed to change the position and rotate a GIF image in given angles as per user inputs in a MFC application .
So I started to use Image object in GDI+.My intention was to make a Image object and manupulate its position and orientation.(As given in msdn page titled Drawing, Positioning, and Cloning Images - refer the link below)
http://msdn.microsoft.com/library/de...wofGDIPlus.asp[^]
I tried to insert a image to my main frame using "Image" in GDI+. But a runtime error (unhandled exception) is occuring when im going to run the program.The details are as follows.
I have included "gdiplus.h" in StdAfx.h. There were no issues on that.But the problem started when i tried to insert a image using the guidelines given in above msdn link(.Drawing, Positioning, and Cloning Images - GDI+)
As per that method I used the following code:
Code:
CPaintDC dc(this);
Graphics myGraphics(dc.m_hDC);
Image myImage(L"robot.gif"); // this line creates the problem
myGraphics.DrawImage(&myImage, 20, 10);
The program Built & compiled successfully in VC++ 6.0.But didn't run.It gaves a error.
When I insert that code to a .NET project the error message says that ;"Unhandled exception at 0x7c9105f8 in tttdk.exe: 0xC0000005: Access violation reading location 0x00000010."
When I break it , it shows the location of the error in the following cpp file.
D:\VS\VC\atlmfc\src\atl\atls\allocate.cpp
..
Code:
...
CAtlTraceCategory *CAtlAllocator::GetCategory(int iCategory) const
{
if(iCategory == m_pProcess->CategoryCount())
return NULL;
ATLASSERT((iCategory < m_pProcess->CategoryCount()) || (iCategory == -1));
CAtlTraceCategory *pCategory = NULL;
if(iCategory >= 0)
{
BYTE *pb = reinterpret_cast(m_pProcess) + m_pProcess->MaxSize(); // this is the location of the error
pCategory = reinterpret_cast(pb) - iCategory - 1;
}
return pCategory;
}
..............
Please help me regarding the above matter ASAP.or else tell me way to Insert a GIF image to a MFC frame and to change its position and rotate by given angles time to time.
Thisara
ENTC
UoM