As an alternate approach, you can add properties and methods by typing directly into the text page using Delphi or IDL syntax. For example, if you are working in Delphi syntax, you can type the following property declarations into the text page of an interface:
Interface1 = interface(IDispatch) [ uuid '{5FD36EEF-70E5-11D1-AA62-00C04FB16F42}', version 1.0, dual, oleautomation ] function AutoSelect: Integer [propget, dispid $00000002]; safecall; // Add this function AutoSize: WordBool [propget, dispid $00000001]; safecall; // And this procedure AutoSize(Value: WordBool) [propput, dispid $00000001]; safecall; // And this end;
If you are working in IDL, you can add the same declarations as follows:
[ uuid(5FD36EEF-70E5-11D1-AA62-00C04FB16F42), version(1.0), dual, oleautomation ] interface Interface1: IDispatch { // Add everything between the curly braces [propget, id(0x00000002)] HRESULT _stdcall AutoSelect([out, retval] long Value ); [propget, id(0x00000003)] HRESULT _stdcall AutoSize([out, retval] VARIANT_BOOL Value ); [propput, id(0x00000003)] HRESULT _stdcall AutoSize([in] VARIANT_BOOL Value ); };
After you have added members to an interface using the interface text page, the members appear as separate items in the object list pane, each with its own attributes, flags, and parameters pages. You can modify each new property or method by selecting it in the object list pane and using these pages, or by making edits directly in the text page.
If the interface is associated with a CoClass that was generated by a wizard, you can tell the Type Library Editor to apply your changes to the implementation file by clicking the Refresh button on the toolbar. The Type Library Editor adds new methods to your implementation class to reflect the new members. You can then locate the new methods in implementation unit's source code and fill in their bodies to complete the implementation.
If you have the Apply Updates dialog enabled, the Type Library Editor notifies you of all changes before updating the sources and warns you of potential problems.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|