PxPlus Type Library Browser |
|
The PxPlus Type Library Browser (TLB) was developed to provide extended type information for Windows COM objects and to help simplify the process of creating event class objects.
The Type Library Browser can be used to display any COM object's type library, showing the object's CoClass and GUID information, along with the properties, methods and events supported by the control. It can also be used to create PxPlus OOP objects that will help simplify the handling of events generated by COM controls.
The following steps explain how to start the Type Library Browser and display extended type information for a selected COM object (in this case, the Microsoft Calendar Control):
|
1. |
Start the Type Library Browser by launching PVXTLB.EXE from Windows Explorer or via Start > Run. | ||||||||||||||||||||
|
2. |
Select Open from the File menu to display all registered OLE/COM objects. The Registered Type Libraries window displays. | ||||||||||||||||||||
|
3. |
Scroll down and select Microsoft Calendar Control. The type library information for the Microsoft Calendar Control is loaded into the Type Library Browser. See the illustration below. | ||||||||||||||||||||
|
4. |
Click on the Calendar object in the Classes list. This shows that the Calendar object has two members: DCalendarEvents and ICalendar. | ||||||||||||||||||||
|
5. |
The icon to the left of each item denotes the class type. To see a complete list of the icons used to identify class types in the Type Library Browser, select Legend from the View menu. See the illustration below.
| ||||||||||||||||||||
|
6. |
Close the Legend window and select the ICalendar class. The Members list will now display the methods and properties of the ICalendar class. This class contains about a dozen methods with names, such as NextWeek( ) and NextYear( ), which can be accessed using the PxPlus OCX/COM Interface. | ||||||||||||||||||||
|
7. |
Select the DCalendarEvents class from the Classes list. The Members list will display all the methods, properties and events supported by the DCalendarEvents class.
Check boxes identify which members are to be used by the Type Library Browser for generating an event template (see Creating an Event Template below). Initially, they are all selected by default. This defines all the events the Calendar control can fire. |
The following steps describe the event template generation feature of the Type Library Browser:
|
1. |
To create an event template for the DCalendarEvents interface, choose events (select/deselect check boxes) from the Members list, then click the link Create an Event Template based on this Interface located in the Entity Documentation section. The Save As file box appears. |
|
2. |
Save the generated file as DCalendarEvents.pvc. The Type Library Browser will generate a text file that contains the source code for a PxPlus OOP object. This text file can be opened with an editor, such as Notepad. The PxPlus event handler class DCalendarEvents.pvc has a function declared for each member event selected in the Members list. If the NewMonth event check box is selected, then an Event_NewMonth function will be declared. |
|
3. |
Each function contains a comment "Insert code here". Replace this comment with the necessary PxPlus code. |
The Type Library Browser accepts optional arguments that enable the retrieval of the type library information of a given COM object. To retrieve the type library information of the Calendar control, pass the name and path of the Calendar OCX. To do this from a PxPlus console, perform the following:
Invoke "PVXTLB.EXE"+QUO+C:\Program Files\MicrosoftOffice\Office\MSCAL.OCX"+QUO
PxPlus objects contain two properties: PvxTypeLib and PvxISA. The PvxTypeLib property returns the type library file from an object. The PvxISA property contains the name of the instantiated class.
Invoke the Type Library Browser from a PxPlus console and pass the value of these two properties to display the type library information of a loaded COM object:
|
1. |
Instantiate the Calendar COM Object: |
|
2. |
Invoke the TLB, passing the PxPlus object's PvxTypeLib$ and PvxISA $ properties: |
The Type Library Browser window displays the Calendar controls type library with the Icalendar class highlighted.
An alternative method for invoking the Type Library Browser is to use the PxPlus Command line shortcut program called TLB.
Example:
Def object x, "MSCAL.Calendar"
TLB x