Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OK to search .vcx file programatically?
Message
From
16/09/1998 18:21:55
 
 
To
15/09/1998 09:20:10
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00136686
Message ID:
00137545
Views:
14
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform