Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ole error code 0x, Trappable?
Message
De
15/04/2006 00:16:33
 
 
À
14/04/2006 19:21:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01113807
Message ID:
01113829
Vues:
18
>I'm using an OLE control on a form that some users will have and some won't. Opening the form when you don't have the control gives the "OLE error code 0x---- not found".
>
>So I figure if they don't have the object, I can do something like this for the OLE control:
>
>

>PROCEDURE INIT
>If IDontHaveTheControl
> return .f.
>endif
>ENDPROC
>

>
>That still gets an error.
>
>So I tried, ON ERROR Do l_NoErrorMsg before calling the form. Still get the error message though.
>
>Is there anyway to trap that error so that the user won't see it?

Try this:
FUNCTION CheckOCX
LPARAMETERS pcControlClass
LOCAL llOCXError, loOLEForm
PUBLIC glOCXError
ON ERROR STORE .T. to glOCXError
glOCXError = .F.
loOLEForm = CREATEOBJECT('Form')
loOLEForm.AddObject('OCXTest','OLEControl',pcControlClass)
ON ERROR DO <YourErrHandler>
llOCXError = glOCXError
RELEASE glOCXError
RETURN llOCXError
ENDFUNC


*-*  Sample Call
llOCXOk = CheckOCX("MSComctlLib.TreeCtrl")
IF .NOT. llOCXOk
...
ENDIF
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform