Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OK to search .vcx file programatically?
Message
De
19/09/1998 13:27:13
 
 
À
16/09/1998 18:21:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00136686
Message ID:
00138662
Vues:
15
>>I want to know whether a class exists in a certain library before I try to instantiate it in my program (reason: I don't want to get an error message if it doesn't exist). I couldn't find a function for this and the only thing I could come up with is to open the class library programatically and search for objname. This worked, but I felt a little uneasy about touching the .vcx from within a program. <<
>
>First, upgrade to VFP 6.0 if you already haven't. Then use the new AVCXCLASSES() function, and you can use a little PRG I wrote that uses it called ClassIn.prg:
>
>
>* ClassIn.prg
>* Ken R. Levy
>
>
>LPARAMETERS tcClass,tcClassLibrary
>LOCAL lcClassLibrary,llClassFound,lnCount
>LOCAL laVCXClasses[1]
>
>IF EMPTY(tcClass) OR EMPTY(tcClassLibrary)
>	RETURN .F.
>ENDIF
>lcClassLibrary=LOWER(ALLTRIM(tcClassLibrary))
>IF EMPTY(JUSTEXT(lcClassLibrary))
>	lcClassLibrary=FORCEEXT(lcClassLibrary,"vcx")
>ENDIF	
>IF NOT FILE(lcClassLibrary)
>	RETURN .F.
>ENDIF
>llClassFound=.F.
>FOR lnCount = 1 TO AVCXCLASSES(laVCXClasses,lcClassLibrary)
>	IF LOWER(laVCXClasses[lnCount,1])==LOWER(tcClass)
>		llClassFound=.T.
>		EXIT
>	ENDIF
>ENDFOR
>RETURN llClassFound
>
Ken -

Thanks for the code. I haven't yet upgraded to VFP 6.0, but have just ordered it.

Sylvia
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform