[[Property:title|Creating a new component from an Eiffel project]]
[[Property:weight|1]]
[[Property:uuid|f1f6711a-989b-f182-377d-89dd827401d5]]
The second tutorial describes creating a COM component from an Eiffel system. The tutorial example String is almost identical to StringManipulator of the previous tutorial. In the StringManipulator example the wizard starts from an IDL file and builds an Eiffel System; in contrast, the String example takes an Eiffel system and generates an IDL file and the required plumbing code to make the Eiffel project accessible to COM.
==Step by step instructions==
# Create a new Eiffel project in the directory ''$ISE_EIFFEL\examples\com\wizard\e2idl\eproject'' where $ISE_EIFFEL represents the path to the EiffelStudio installation directory.
# Select the ECF file located in the same directory and compile.
# Start the EiffelCOM Wizard
# In '''Project''', in the '''Current project''' input field, type in ''string'' and press '''enter'''.
# In '''Project Type''', choose ''Add a COM interface to an existing Eiffel project''.
# In the field under '''Path to Eiffel project location''' enter ''$ISE_EIFFEL\examples\com\wizard\e2idl\eproject''.
# Click the browse button under '''Path to system's configuration file (*.ecf)''' and open the file ''$ISE_EIFFEL\examples\com\wizard\e2idl\eproject\string.ecf''.
# In the text field under '''Target to use''', enter: ''string''.
# In the text field under '''Name of Eiffel facade class''', enter: string_manipulator.
# In the text field under '''Name of Eiffel facade class cluster''', enter: root_cluster.
# 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. Choose ''$ISE_EIFFEL\examples\com\wizard\e2idl\generated''.
# 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==
The generated Eiffel classes include:
* ISTRING_MANIPULATOR_INTERFACE: This class represents the only interface exposed by the COM component.
* STRING_MANIPULATOR_PROXY_IMP: This class implements the coclass, it inherits from the interface and implements its members.
* ECOM_STRING_REGISTRATION: This class contains the code required to register the component.
You do not need to modify or implement any classes. The wizard produces a ready-to-use component.
{{tip|
In most Eiffel systems functionality is spread out throughout the system. No single class exposes the full functionality of the system and can serve as a Facade to the outside world. Running the wizard on any such class would not be practical. Before starting the wizard write an Eiffel class that acts as a Facade and forwards client calls to the appropriate subsystems. Enter the Facade class name into '''Name of Eiffel facade class''' field. The wizard generates an IDL file from this class. }}
{{seealso|
[[Creating a New COM Component|Creating a New COM Component]]
[[Accessing a COM Component|Accessing a COM Component.]] }}