How to Programatically List .VCX File's Class DefinitionsLast reviewed: April 30, 1996Article ID: Q129512 |
The information in this article applies to:
SUMMARYA Visual Class Library (VCX) contains references to classes. This article provides two methods that will allow you to list the name of the classes contained in a class library.
MORE INFORMATIONThe Visual Class designer provides an interface that allows you to create classes visually. The class definitions are stored in a table with a .VCX extension. Although there is no native Visual FoxPro command that will allow you to list all the classes saved in a .VCX file, there are ways to retrieve this information.
Use the VCX as a TableA VCX is a FoxPro table, so you can open it with the USE command, and you can manipulate the table as if it were a .DBF file. When a class is created, a new record is added for each object that belongs to the class. Additionally, the first record for the class contains information about the class definition, and the Reserved1 field of the .VCX file contains the word "Class" to tag a class definition. It is therefore possible to query the table for these records that have the Class string in the Reserved1 field. The following example queries the LOGIN.VCX file located in the SAMPLES\MAINSAMP\LIBS directory; it retrieves the name of class definitions.
olddir=CURDIR() CD SYS(2004)+"SAMPLES\MAINSAMP\LIBS" IF NOT USED('LOGIN.VCX') USE LOGIN.VCX NOUPDATE ELSE SELECT LOGIN.VCX ENDIF SELECT PADR(objname,20) FROM LOGIN.VCX WHERE Reserved1=='Class' ; INTO ARRAY myarray = MESSAGEBOX ("There are "+ALLTRIM(str(alen(myarray)))+ " classes") CD EVALUATE('olddir') Use the Class BrowserIn development mode, you can use the Class Browser to list the classes in a .VCX file. To do so:
REFERENCESFor more information about the Class Browser, search for "_BROWSER" and "Sample Files" topics in the Visual FoxPro Help menu.
|
Additional reference words: 3.00 VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |