|
Hi all,
I am trying to show single-frame/animated GIF images in a window created by 'CreateWindowEx'. I have used Image *, Graphics * (method DrawImage(Image *, INT, INT, INT, INT)) of GdiPlus dll. I used memry DC to avoid flickering. This was working fine.
Now the problem is that - When I add 2 commands /DYNAMICBASE and /NXCOMPAT in linker command line (VS 2005 project settings), the application simply crashes when trying to show any kind of GIF image. Although it is showing BMP, DIB, WMF, JPG, JPEG and TIFF images perfectly.
To see where the actual problem is i ran it in debug mode and find GdiPlus::Graphics::DrawImage fail to process. The Application Verifier 4.0 points that it is due to some bad address pointer. The astonishinig matter is that, in debug mode if I ignore the crash and click on 'Continue', the 'DrawImagw' returns StatusResult "Ok" and 'BitBilt' draws the image perfectly in my application window.
Thanks in advance, for helping me out of this situation.
Subha
|
|
|
|
|
why not use try-catch block to fix this problem?
|
|
|
|
|
Thanks for the suggesstion Xing. Since I am writting code in pur C++ and using Win32 APIs, I didn't found what is the exception class I should use to catch it. If you can suggest me, that'll be better for me.
|
|
|
|
|
See Exceptions[^].
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
subhabasu wrote: , I didn't found what is the exception class
Though i know, this is not a good approach, but here you can use this block to catch all the exception :-
try
{
}
catch(...)
{
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks Xing and Hamid,
I even tried with
try{
// My code snippet
}
catch(...)
{
::Messagebox(0,0,0,0);
}
It does not enter in catch part. I am feeling sick of this
|
|
|
|
|
What was the error and did you use of your program on the vista?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi Hamid,
Now, I find where the problem occurrs. It is nothing to do with the project setting /DYNAMICBASE or /NXCOMPAT in Linker command line.
The application only crashes if I run it with Application Verifier 4.0. Otherwise it is able to show (DrawImage) any kind of GIF image.
I am giving a part of the xml file generated by the Application Verifier 4.0. I hope it will help you to understand the error properly, which I could not resolve till now.
<avrf:logEntry Time="2009-04-15 : 12:18:56" LayerName="Heaps" StopCode="0x13" Severity="Error">
<avrf:message>First chance access violation for current stack trace.</avrf:message>
<avrf:parameter1>5960002 - Invalid address causing the exception.</avrf:parameter1>
<avrf:parameter2>4ed9b280 - Code address executing the invalid access.</avrf:parameter2>
<avrf:parameter3>129838 - Exception record.</avrf:parameter3>
<avrf:parameter4>129854 - Context record.</avrf:parameter4>
|
|
|
|
|
Did you use of this code on your code?
__try
{
}
__except( EXCEPTION_EXECUTE_HANDLER)
{
}
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi Hamid and Xing,
Many many thanks for your suggestion. I tried what both of you have said. But that was giving "error C2712: Cannot use __try in functions that require object unwinding" in my VS 2005. Anyway I solved that error by setting "Enable C++ Exceptions" to "No". Now I can track the exception, though generating too many warnings at compile time (for disabling C++ exceptions). So, the application doesn't crashes anymore.
Anyway, I need to show the GIF images. So, how can I do that after getting that exception - EXCEPTION_EXECUTE_HANDLER. What should I do
|
|
|
|
|
|
Hi Xing,
Thanks for your enthuasism, what you and Hamid have shown to my problem.
I used that __try-__exception() block. Inside that I call 'GetExceptionCode' API, which returns me the error code 0x80000003. It means EXCEPTION_BREAKPOINT (#define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT in winbase.h). And in winnt.h STATUS_BREAKPOINT is defined as 0x80000003. So, right now I am here, back again in the square.
I don't understand what is the problem with Application Verifier 4.0. Without tracking by it, the application works fine.
|
|
|
|
|
I guess Application Verifier use more strict strategy, just like you can compile project with /W4 option.
|
|
|
|
|
what are the changes required to open a vs 2008 project into vs 2005?
|
|
|
|
|
Purish Dwivedi wrote: what are the changes required to open a vs 2008 project into vs 2005?
Don't think that it would be easy to do this. you may better ask this in the Visual Studio Forum
You can create a new project in VS2005 and add your existing files from VS2008 to this project. Be careful that you are not using API's added in VS2008 in your code.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
It's not working.
It needs some change in version in the .sln file,I think so....
|
|
|
|
|
What is not working? The idea given by me or opening Vs2008 file in Vs2005 fails. I think the format for the two version's .sln files would also be different.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
_AnsHUMAN_ wrote: Be careful that you are not using API's added in VS2008 in your code.
There are no APIs that 'belongs' to any particular version of VS. You're probably talking about the SDK.
Or, if you were talking about compiler specific features like the TR1 library extensions, then there would be no way to run it on a compiler that doesn't implement it anyways.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hello
If you are just using standard features which are also available with VS2005, just change version number to 8.0 and also do relative changes and apply the same for vcproj file (just version number change,etc.). I learnt this in here from someone couple of weeks ago and it is working for me so far.
Hope this helps.
Bekir.
|
|
|
|
|
one more thing needs change except version number.
I don't remember exactly. Hope u can find out...
Thanks for reply.
|
|
|
|
|
only the version strings at the beginning of the *.sln and the included *.vcproj files!!! I make sometimes "myproj2008.sln" and "myproj2005.sln" files because of some reasons.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
|
I want to Design a client class to connect with asp.NET webservice
i m using soapsud toolkit and msvisalstdio 2008 and Project type is mfc dialog based
CoInitialize(NULL);
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
Connector.CreateInstance(__uuidof(HttpConnector));
Connector->Property["EndPointURL"] = "http://localhost/PC_Stub/PaymentCloud.svc";
Connector->Connect();
Connector->Property["SoapAction"]= "http://localhost/PC_Stub/PaymentCloud.svc";
Connector->BeginMessage();
Serializer.CreateInstance(__uuidof(SoapSerializer));
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
Serializer->startEnvelope("","","");
Serializer->startBody("");
Serializer->startElement("isuseronline",
"http://localhost/PC_Stub/PaymentCloud.svc",
"",
"m");
Serializer->startElement("CustomerID","87654321");
Serializer->writeString("CustomerID");
Serializer->endElement();
Serializer->endElement();
Serializer->endBody();
Serializer->endEnvelope();
Connector->EndMessage();
Reader.CreateInstance(__uuidof(SoapReader));
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream),
"");
((const char *)Reader->RPCResult->text);
CString s=Reader->RPCResult ->text;
AfxMessageBox(CString(W2T(Reader->RPCResult->text)));
CoUninitialize();
But its giving no results plz suggest how to build c++ client ( i want to pass parameters to service so using (MFC dialogs))
|
|
|
|
|
As a quick note, I've never worked with SDL before.
Basically, what I'm trying to play a movie file, and it slowed down way too much by converting a frame to a PPM file, loading it up using freeimage, and then displaying it. (most of the performance hit actually came from freeimage loading the PPM, and I tried converting to BMP and loading the BMP file into an HIMAGE but that took even longer)
Anyways, I don't want to rewrite the rest of my code to use SDL if I don't have to, so is there any way I can use SDL to output to an HDC instead of an SDL_Surface?
|
|
|
|
|
I don't think you will be able to mix GDI and SDL to draw on the same window. But, I'm not sure about it.
Anyway, what I wanted to point out is why is this a problem ? Are you loading your image each frame ? If the load time is long, this is not really a problem because it happens only once, when your image is first loaded in memory. If you reload the image for each frame, then you are doing something seriously wrong...
|
|
|
|