[ Pobierz całość w formacie PDF ]
.Using the Type Library editor can greatly simplify the task ofdeveloping COM objects by centralizing the tasks of defining interfaces, CoClasses,and types, obtaining GUIDs for new interfaces, associating interfaces with CoClasses,updating implementation units, and so on.Note The Type Library editor is also used to define CORBA interfaces in projects that usethe CORBA Object or CORBA Data Module wizard.The Type Library editor outputs two types of file that represent the contents of thetype library:Table 34.1 Type Library editor filesFile Description.TLB file The binary type library file.By default, you do not need to use this file, because thetype library is automatically compiled into the application as a resource.However,you can use this file to explicitly compile the type library into another project or todeploy the type library separately from the.exe or.ocx.For more information, see Opening an existing type library on page 34-19 and Deploying type librarieson page 34-27.Note: When using the Type Library editor for CORBA interfaces, the Type Libraryeditor does not create the.tlb file._TLB unit This unit interprets the contents of the type library for use by your application.Itcontains all the declarations your application needs to use the elements defined inthe type library.Although you can open this file in the code editor, you shouldnever edit it it is maintained by the Type Library editor, so any changes you makewill be overwritten by the Type Library editor.For more details on the contents ofthis file, see Code generated when you import type library information onpage 35-5.Note: When using the Type Library editor for CORBA interfaces, this unit definesthe stub and skeleton objects required by the CORBA application.34-2 Devel oper s Gui deTy p e L i b r a r y e d i t o rParts of the Type Library editorThe main elements of the Type Library editor are described in Table 34.2:Table 34.2 Type Library editor partsPart DescriptionToolbar Includes buttons to add new types, CoClasses, interfaces, and interfacemembers to your type library.The toolbar also includes buttons for refreshingyour implementation unit, registering the type library, and saving an IDL filewith the information in your type library.Object list pane Displays all the existing elements in the type library.When you click on anitem in the object list pane, it displays pages valid for that object.Status bar Displays syntax errors if you try to add invalid types to your type library.Pages Display information about the selected object.Which pages appear heredepends on the type of object selected.These parts are illustrated in Figure 34.1, which shows the Type Library editordisplaying type information for a COM object named cyc.Figure 34.1 Type Library editorToolbarThe Type Library editor s toolbar located at the top of the Type Library Editor,contains buttons that you click to add new objects into your type library.The first group of buttons let you add elements to the type library.When you click atoolbar button, the icon for that element appears in the object list pane.You can thencustomize its attributes in the right pane.Depending on the type of icon you select,different pages of information appear to the right.Wor k i ng wi t h t y pe l i br ar i es 34-3Ty p e L i b r a r y e d i t o rThe following table lists the elements you can add to your type library:Icon MeaningAn interface description.A dispinterface description.(not used for CORBA interface definitions)A CoClass.An enumeration.An alias.A record.A union.A module.When you select one of the elements listed above in the object list pane, the secondgroup of buttons displays members that are valid for that element.For example,when you select Interface, the Method and Property icons in the second box becomeenabled because you can add methods and properties to your interface definition.When you select Enum, the second group of buttons changes to display the Constmember, which is the only valid member for Enum type information.The following table lists the members that can be added to elements in the object listpane:Icon MeaningA method of the interface, dispinterface, or an entry point in a module.A property on an interface or dispinterface.A write-only property.(available from the drop-down list on the property button)A read-write property.(available from the drop-down list on the property button)A read-only property.(available from the drop-down list on the property button)A field in a record or union.A constant in an enum or a module.34-4 Devel oper s Gui deTy p e L i b r a r y e d i t o rIn the third box, you can choose to refresh, register, or export your type library (saveit as an IDL file), as described in Saving and registering type library information onpage 34-24.Object list paneThe Object list pane displays all the elements of the current type library in a treeview.The root of the tree represents the type library itself, and appears as thefollowing icon:Descending from the type library node are the elements in the type library:Figure 34.2 Object list paneWhen you select any of these elements (including the type library itself), the pages oftype information to the right change to reflect only the relevant information for thatelement.You can use these pages to edit the definition and properties of the selectedelement.You can manipulate the elements in the object list pane by right clicking to get theobject list pane context menu.This menu includes commands that let you use theWindows clipboard to move or copy existing elements as well as commands to addnew elements or customize the appearance of the Type Library editor
[ Pobierz całość w formacie PDF ]