|
Hi,
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/default.asp?url=/library/en-us/gdicpp/GDIPlus/AboutGDIPlus/IntroductiontoGDIPlus/OverviewofGDIPlus.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:
CPaintDC dc(this);<br />
Graphics myGraphics(dc.m_hDC);<br />
<br />
Image myImage(L"robot.gif");
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
<small>..<br />
<br />
...<br />
<br />
CAtlTraceCategory *CAtlAllocator::GetCategory(int iCategory) const<br />
<br />
{<br />
<br />
if(iCategory == m_pProcess->CategoryCount())<br />
<br />
return NULL;<br />
<br />
<br />
<br />
ATLASSERT((iCategory < m_pProcess->CategoryCount()) || (iCategory == -1));<br />
<br />
CAtlTraceCategory *pCategory = NULL;<br />
<br />
if(iCategory >= 0)<br />
<br />
{<br />
<br />
BYTE *pb = reinterpret_cast(m_pProcess) + m_pProcess->MaxSize();
<br />
pCategory = reinterpret_cast(pb) - iCategory - 1;<br />
<br />
}<br />
<br />
return pCategory;<br />
<br />
}<br />
<br />
..............</small>
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
|
|
|
|
|
Just a shot-in-the-dark:
Based on your code line alone:
BYTE *pb = reinterpret_cast<???>(m_pProcess) + m_pProcess->MaxSize();
Is MaxSize by any chance the fourth virtual method in m_pProcess? Do you have a memset(m_pProcess, 0, sizeof(...)) or equivalent somewhere? If so I think you are zeroing out the vtable. You can't use memset on a class with virtual methods.
Based on the code above that is the only thing I can think of that would make it crash.
---
Dhananjayak02 wrote: The program Built & compiled successfully in VC++ 6.0.But didn't run.It gaves a error.
What error?
Mike
|
|
|
|
|
Dear Mike,
Thank u very much for attending this matter.Actually I dont know what is error that comes when im runing the application.
There appears a window asking whether to send the error report to Microsoft. I tried to see the technical information in that report.But can't understand.It states about an exception. The appilication error states that the memory could not read at a location(memory address was given)
When I debug it following appeared..
Loaded symbols for 'D:\_Thisara\GDIplusProjectTDK\Debug\GDIplusProjectTDK.exe'
Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINDOWS\system32\MFC42D.DLL'
Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL'
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINDOWS\system32\MFCO42D.DLL'
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.2600.2180_x-ww_522f9f82\GdiPlus.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\uxtheme.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found.
The thread 0x620 has exited with code 0 (0x0).
The thread 0x9C8 has exited with code -1073741819 (0xC0000005).
The program 'D:\_Thisara\GDIplusProjectTDK\Debug\GDIplusProjectTDK.exe' has exited with code -1073741819 (0xC0000005).
ENTC
UoM
|
|
|
|
|
Right - that is to be expected! That information says exactly the same thing as your OP.
> The thread 0x9C8 has exited with code -1073741819 (0xC0000005).
0xC0000005 is the code for an access violation. I refer you to my previous post - what is m_pProcess? One of your classes? Or a library class? If so, which library and what's its type? CProcess? Check to make sure you aren't memset-ing m_pProcess to zero anywhere.
Mike
|
|
|
|
|
|
plz kindly help me
#sanroop#
|
|
|
|
|
look at the Shell_NotifyIcon() API. You can add an icon, then later modify it using this API.
|
|
|
|
|
Hi all,
I have flicked through the examples here on CP but not really found what I want. I'm looking for code examples/thoughts/ideas on the following:
1. Self modifying code
2. Self detecting if exe has been copied
3. PC serial numbers (anything unique to a single computer)
Maybe it is impossible but I am trying to develop 'full version' exe that will revert back to a 'demo version' if copied to another machine.
|
|
|
|
|
waldermort wrote: 2. Self detecting if exe has been copied
Not possible as far as I know.
waldermort wrote: 3. PC serial numbers (anything unique to a single computer)
Even if you were to take the HDD's volume/serial number, what would happen if my HDD crashed and I got everything restored to a new HDD? The software would detect that something is different and stop working. I'm not sure how to effectively handle this.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
waldermort wrote: 1. Self modifying code
You can do this in Assembly, which is more fun than C++ anyway.
Good luck with it
Joe Q
|
|
|
|
|
waldermort wrote: 1. Self modifying code
2. Self detecting if exe has been copied
the only thing i can think of is using resources, reate some kind of CRC em embedd it in a resource (ex: image)
However this is easy to crack
waldermort wrote: PC serial numbers (anything unique to a single computer)
Network card adapter number (MAC address)?
People could allways change the card from one PC to another, but the software only works wher the card is.
|
|
|
|
|
Thanks for all the ideas everybody. This project is just something I would like to try in the near future. I guess I have a bit more reading to do before I make a start.
|
|
|
|
|
Hi all,
I have explored the MSMQEvent in VC++. But i can't get a Clear Picture, which is used to Capture the Arrival of any Message from the End User to invoke the MSMQ Service.
I want an example on MSMQEvent, Not all other stuff on MSMQ. please help me out.
Uday kiran
|
|
|
|
|
I want to set the menu bar to be ticked or not to be ticked by code. How to do it...
Photo[^]
|
|
|
|
|
|
DWORD CheckMenuItem(HMENU hmenu,
UINT uIDCheckItem,
UINT uCheck
);
what is HMENU hmenu?
|
|
|
|
|
mimimimilaw wrote: what is HMENU hmenu?
Its handle to menu,
Have you seen this example
|
|
|
|
|
|
<br />
(1)<br />
HMENU hmenu=::GetMenu(m_hWnd);<br />
CheckMenuItem(<br />
GetSubMenu(hmenu,0),ID_FILE_OPEN,MF_BYCOMMAND|MF_CHECKED);<br />
---------------------<br />
(2)<br />
CMenu *menu=GetMenu();<br />
CMenu *menu22=menu->GetSubMenu(0);<br />
menu22->CheckMenuItem(ID_FILE_OPEN,MF_BYCOMMAND|MF_CHECKED);<br />
<br />
|
|
|
|
|
Hai,
plz help me ,
1) i want to design a program that should calculate's the objects in a class.
in which way i design that problem .
plz help
-- modified at 5:21 Monday 14th August, 2006
Hi,
Thanks, if u think it's good.
otherwise sorry.
|
|
|
|
|
U r looking for objects in a class or objects of a class? If it is the later, ie how to track the the number of objects created for a class, u can use below demo.
class InstanceCntDemo{<br />
<br />
private :<br />
static int nCnt; <br />
public:<br />
InstanceCntDemo(){<br />
nCnt++;<br />
}<br />
static int GetCnt()<br />
{<br />
return nCnt;<br />
}<br />
};<br />
int InstanceCntDemo::nCnt =0;<br />
<br />
int main(){<br />
<br />
InstanceCntDemo ic;<br />
InstanceCntDemo ic1;<br />
InstanceCntDemo ic2;<br />
InstanceCntDemo ic3;<br />
<br />
int nCnt = InstanceCntDemo::GetCnt(); <br />
};
Does this make sense?
Cheers MiltonKB.
|
|
|
|
|
Thanks Mr.MiltonKB.
Hi,
Thanks, if u think it's good.
otherwise sorry.
|
|
|
|
|
Dear all,
I had one MDI application and I want to limit its execution to single instance.
I had tried source code from lots of articles (i.e Newcomer's, Naughter ...Armen...)
it will work ...but while closing the second instance it raises an exception ...
Abnormal program termination!!!
This exception generated from "WinMain" when the
"pthread->ExitInstance()" get called...
How can I solve this ?
I am using Windows XP SP2 .....and VC++ 6.0
Thanks in advance......
-- modified at 5:17 Monday 14th August, 2006
vinsankar
|
|
|
|
|
how you are limiting its instances ?
|
|
|
|
|