Delphi - C0000008 external exception when an application starts from the IDE

When an application is launched from the IDE and a debugger is attached, the "External exception C0000008" exception occurs when trying to connect to an imported ActiveX control.

If the application is launched offline or the Rad Studio options / Debugging options / Integrated debugging is not checked, the program works as expected, there will be no exception, and the ActiveX control returns the expected result.

There are other ActiveX controls in the project, all of which work fine.

I tried: - Reinstalling the ActiveX control - Re-importing the ActiveX control - Removing any software that may cause conflicts (experts / plugins, etc.) - Disabling most running applications and services, etc. If they cause conflict.

Google search. Others seem to have the same problem, but there is no fix that can be found (other than turning off Integrated debugging, but obviously this is not a valid option.

Does anyone have any ideas to solve this problem?

I am using Delphi 2007

+6
delphi activex
source share
2 answers

C0000008 is the status returned for the invalid handle. Make sure that your cover, when it goes to create the object, gives it the correct handle, not nil (if it collapses due to the window handle).

Since the application runs fine when it is not connected to the debugger, I assume that the shell handles this condition gracefully, so the error most likely occurs inside the try / except block.

+2
source share

This is a combination of non-obvious function behavior and IDE parameters.

MSDN CloseHandle

If the application is run under the debugger, the function throws an exception if it receives either an invalid descriptor value or a pseudo descriptor value. This can happen if you close the handle twice or you call CloseHandle on the handle returned by the FindFirstFile function instead of calling the FindClose function.

So, there are two options: either check the code for the place where some invalid descriptor closes, or disable the IDE notifying about this exception. Go to Tools > Options > Debugger options > Emb debuggers > Native OS exceptions , find Invalid Handle and change On resume to Run handled . It worked for me.

Credits for this solution go to _Vasilisk_ from the sql.ru forum.

+2
source share

All Articles