How to detect if a OCX is registered before app generates an error because it is not
Posted on 2006-07-20
I have a Delphi app and I have integrated a 3rd party PDF reader OCX, however the problem is I can't check to see if the OCX is registered (and fix the problem by registering it) before the app crashes with a Kernal32 error (because the OCX is embedded in the main form). I know I could fix this with an installer (which registers the OCX) but it would be alot more elegant if the program could check for the proper registration and then register it before finishing initialization. Is there any way to do this?
First thing in my main form's OnCreate I am calling this code (but unfortunately it never gets called):
// If OCX didn't load (OCXHand = 0) then attempt to register it
if OCXHand = 0 then
if (GetProcAddress(OCXHand,'DllRegisterServer')<> nil) then
StandardEurekaError('Error Registering OCX VSPDFViewerX');