[[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 <eiffel>String</eiffel> is almost identical to <eiffel>StringManipulator</eiffel> of the previous tutorial. In the <eiffel>StringManipulator</eiffel> example the wizard starts from an IDL file and builds an Eiffel System; in contrast, the <eiffel>String</eiffel> 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: <eiffel>string_manipulator</eiffel>. 
# In the text field under '''Name of Eiffel facade class cluster''', enter: <eiffel>root_cluster</eiffel>. 
#  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: 
*  <eiffel>ISTRING_MANIPULATOR_INTERFACE</eiffel>: This class represents the only interface exposed by the COM component. 
*  <eiffel>STRING_MANIPULATOR_PROXY_IMP</eiffel>: This class implements the coclass, it inherits from the interface and implements its members. 
*  <eiffel>ECOM_STRING_REGISTRATION</eiffel>: 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|<br/>
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|<br/>
[[Creating a new COM component|Creating a new COM component]]  <br/>
[[Accessing a COM component|Accessing a COM component.]]  }}






