Delphi menu: file / new / other ...
Press OK [OK] button to click the File / Save menu to save:
Enter the project name mycom Press Save button to open the menu file / new / other ... Press the [OK} button; in CoClassName to enter myObject Press OK to press MOUSE Right button on iMyObject "Enter Test to switch to Parameters page Press ADD to change the Name of the first Parameters into PSPARAM1, Type is entered into the BSTR to change the second parame of the Name to PsResult, Type into the BSTR * Press the MOMET to the second parameters of Modifier fields ... ... "Button button to press OK (original [in] into [out, return], indicating that this is to return, its type is string) Turn off this window (you will see it to help you Building a Code model) File / Save Enter file name MyObject Press to save CDE Press CTRL S Save Project / Build mycom You can see the generated mycom.dll file, this is the COM component you want, Use the regsvr32 command to register this component after you can use it. Next, the method of calling this COM component: New a new application plus a COMOBJ plus a button in the Uses In the Form in the Button's OnClick event into the following Code:
Code:
Var myObject: olevariant; begin myObject: = CreateoleObject ('mycom.myobject'); tryMessage (myObject.test ('dawn')); finally varclear (myObject); end; end;
Execute ..... and press the Button1 button you will see a message ... That is the return value of the Test method for the COM object