views:

61

answers:

2

Hello,

I have to use an ActiveX Object (QlikOCX.ocx). So I've created a very small sample application, which works fine, but when I close the application I get an error like this:

"application.exe doesn't work anymore -> Search online for an solution and close the programm -> Close the programm

Problem details: Problem-event-name: APPCRASH ..."

I want to know if it is possible to catch this error in some way? Thank you!

+1  A: 

The error you get can have a lot of causes. It could be a problem in your own code or in the ActiveX control. For example, your process might terminate, yet one of the threads is still running, polling for information or whatever.
Chances are that you don't free the ActiveX control correctly, thus causing something that leaves some unfinished business behind. Running your application within the debugger could provide you the location of the error but chances are that it's a bit more complicated. Sometimes, sh*t just happens...
Did you create a small console application to test this OCX? Or did you import it as a component and did you add it to a form?
In the case of a console application, make sure you're not using a global variable to store the OCX object! Global interfaced objects aren't always released correctly.
If using a component on a form, add an OnClose event on this form and add code in this event that should clean up the OCX control. Don't free it, but see if it has a "Close", "Clear" or "Terminate" function or other cleanup method that needs to be called. And again, don't use global variables for interface-based types like OCX controls.

Workshop Alex
Hi, thansk for the tipps. I used the ocx as component and dropped it onto a form. I tried your advices, but without success. I'm pretty sure it's an bug in the ActiceX control itself. When I create an object of the control at runtime, and then call the free method, I get the same error as when I close the application...
flinkiy1
+1  A: 

Try to call ActiveX.CoFreeUnusedLibraries before exiting the application. If you use Delphi earlier then 7.1 then see Quality Central Report#:3272, there was a bug.

Schnider
Hi, thank this advice - I tried it, but without success :(
flinkiy1