开发者

Delphi - application with activeX control causes "appcrash"

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!


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜