The TYPELIB sample uses a Visual FoxPro class named Typelib, which is stored in ...\Samples\Classes\Typelib.vcx. This container class has an ActiveX control that contains a number of methods to read Type Library information from any .dll, .exe, or .tlb file.
The Typelib wrapper class saves you time by handling much of the work for you. There is a method called ExportTypeLib in this class, which exports the contents of a specified Type Library to a text File.
THISFORM.typelib1.TypeLibName = THISFORM.txtFileName.Value THISFORM.typelib1.ExportTypeLib( )
If you take a look at the generated text file, you will notice that a Type Library can consist of multiple Type Infos. Each Type Info represents a specific class. When you generate a new EXE or DLL from a project using Visual FoxPro, each class in the project, which is marked as OLEPUBLIC will generate a separate Custom OLE Server.
|You only have a single .exe/.dll file, however, this file can contain multiple servers (one for each OLEPUBLIC class). And Visual FoxPro generates a single TLB file for the project. This Type Library file contains a separate Type Info for each OLEPUBLIC class.
Within each Type Info (OLEPUBLIC class), there are also function descriptions. These represent all of the properties and methods of a class. For methods, the Type Library contains both parameter and return types. Some of the possible types are Boolean, string, and variant. Because Visual FoxPro does not strong type memory variables, many of the types used in your custom methods will be variant.
If you take a close look at the functions exported, you will notice double entries for many of the properties. This is because users can set or get the value of this property. And some languages such as Visual Basic make it possible for you to have code executed when one of these properties is accessed or assigned. Hence, the Type Library will represent a single property with 2 entries. If only a single entry exists, then that property is read-only. Properties and methods, which are marked as Hidden or Protected will not appear in the Type Library.