- 17.05 (released) ...
Creating a New COM Component
- Step by Step Instructions
- First Look at the Generated Code
- Implementing the Component
- Running the Component
This first tutorial describes creating a COM component from a COM definition file that is either an IDL file or a Type Library. The tutorial focuses on creating an in-process (DLL) component, called
Step by Step Instructions
- Launch EiffelCOM Wizard. Note: if you are running Windows 7, you will need to right-click "EiffelCOM Wizard" in the start menu and select "Run as administrator".
- In the Current project input field, type in string_manipulator_server and press enter.
- In Project Type, choose Create a new COM component.
- In Component Information, click the browse button (the button with ...) and open the file $ISE_EIFFEL\examples\com\wizard\string_manipulator\string_manipulator.idl where $ISE_EIFFEL represents the path to the EiffelStudio installation directory.
- Make sure Generate and use marshaller DLL is not checked.
- Click Next.
- In Component Type, choose In-process (*.dll).
- In Generation Options, click the browse button and select the directory where the project should be created (which we will later refer to as the destination folder). Choose $ISE_EIFFEL\examples\com\wizard\string_manipulator\generated\component where $ISE_EIFFEL represents the path to the EiffelStudio installation directory.
- Make sure both Compile C code and Compile Eiffel code are checked.
- Make sure Clean destination folder prior to generation is selected.
- Click Generate.
- Wait until the wizard is done.
First Look at the Generated Code
At the end of the processing the EiffelStudio button becomes enabled. Click on it. This will automatically start EiffelStudio with the generated project so you can navigate more easily through the created Eiffel classes. You can save the processing output by clicking the Save button.
The deferred class
Implementing the Component
To do something more interesting than merely returning an error to the client, edit the implementation of the
Running the Component
The component needs to be registered prior to being loaded. Register an out-of-process component using the following syntax:
system_name.exe -Regserverwhere system_name is the name of the component executable file. Register an in-process component using the regsvr32 utility using the following syntax:
regsvr32 system_name.dllwhere system_name is the name of the dll (e.g. string_manipulator). So to register the
regsvr32 string_manipulator_idl.dllOnce registered, follow the steps described in Accessing a COM Component to build the component's client.