So, why do not you want to put this code in the form load and return .f. from there closing form and dispaying message you want?
>Hi Yuri,
>
>Thanks, this is helpful for checking prior to calling the form. Unfortunately I need to check and by-pass the default error message between the Form.Load and the time the Control.init tries to fire. I.e. The form was already called.
>
>
>- Brian
>
>
>>Can not remember where I got it, but here is Cetin Basoz' code:
>>
>>?iCetinBasoz("Word.Application")
>>
>>*---------------------
>>Procedure iCetinBasoz
>>lparameters tcClass
>>#DEFINE HKEY_CLASSES_ROOT -2147483648
>>#DEFINE ERROR_SUCCESS 0
>>
>>DECLARE Integer RegOpenKey IN Win32API ;
>> Integer nHKey, String @cSubKey, Integer @nResult
>>
>>DECLARE Integer RegCloseKey IN Win32API ;
>> Integer nHKey
>>
>>local lnKey
>>lnKey = 0
>>llRetVal = ( RegOpenKey(HKEY_CLASSES_ROOT, tcClass, @lnKey) = ERROR_SUCCESS )
>>if llRetVal
>> RegCloseKey(lnKey)
>>endif
>>return llRetVal
>>
>
>>>Hi all,
>>>
>>>I need to capture for the possibility that an ActiveX control was not loaded on a workstation (i.e. they did not do a necessary update), but I can't seem to trap for the OLE error returned when the form is opening. I've tried capturing in the form.load, form.error, control.init, control.error, etc. but nothing seems to work. All I need to do is just give them a friendlier message than the "OLE error...Class not registered". What am I missing?
>>>
>>>
>>>Thanks,
>>>
>>>- Brian
>>>
>>>VFP6 SP5