ViewVC logotype

Contents of /trunk/Delivery/xmldoc/tools/wizards/com/guided_tour/01_new_from_com.xml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 51737 - (show annotations)
Mon Jun 6 15:52:57 2005 UTC (14 years, 8 months ago) by raphaels
File MIME type: text/xml
File size: 7260 byte(s)
Fixed various issues.

1 <document title="Creating a new COM component" output="studio">
2 <meta_data>
3 <help>
4 <meta>
5 <meta_content>EiffelCOM</meta_content>
6 <name>MS-HKWD</name>
7 </meta>
8 <meta>
9 <meta_content>EiffelCOM Wizard</meta_content>
10 <name>MS-HKWD</name>
11 </meta>
12 <meta>
13 <meta_content>EiffelCOM Wizard, Guided Tour</meta_content>
14 <name>MS-HKWD</name>
15 </meta>
16 <meta>
17 <meta_content>EiffelCOM Wizard, Guided Tour, Creating a new COM component</meta_content>
18 <name>MS-HKWD</name>
19 </meta>
20 </help>
21 </meta_data>
22 <paragraph>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
23 <class_name>StringManipulator</class_name>. The component exposes one interface
24 <class_name>IString</class_name> that includes the functions
25 <feature_name>ReplaceSubstring</feature_name> and
26 <feature_name>PruneAll</feature_name> corresponding respectively to the features
27 <code>
28 <link>
29 <url>../../../../libraries/base/reference/kernel/classic/string_chart.xml</url><anchor_name>f_replace_substring</anchor_name>
30 <label>replace_substring</label>
31 </link>
32 </code> and
33 <code>
34 <link>
35 <url>../../../../libraries/base/reference/kernel/classic/string_chart.xml</url><anchor_name>f_prune_all</anchor_name>
36 <label>prune_all</label>
37 </link>
38 </code> of the class
39 <code>
40 <link>
41 <url>../../../../libraries/base/reference/kernel/classic/string_chart.xml</url>
42 <label>
43 <class_name>STRING</class_name>
44 </label>
45 </link>
46 </code> from the EiffelBase library. <class_name>IString</class_name> also exposes the property
47 <feature_name>String</feature_name> which represents the manipulated string. The property can be set or read.
48 <heading>
49 <size>2</size> Step by step instructions
50 </heading>
51 <list ordered="true">
52 <item>
53 In <bold>Project</bold>, in the <bold>Current project</bold> input field, type in <italic>string_manipulator_server</italic>
54 and press <bold>enter</bold>.
55 </item>
56 <item>
57 In <bold>Project Type</bold>, choose
58 <italic>Create a new COM component</italic>.
59 </item>
60 <item>
61 In <bold>Component Information</bold>, click the browse button (the button with <bold>...</bold>) and open the file
62 <italic>$ISE_EIFFEL\examples\com\wizard\string_manipulator\string_manipulator.idl</italic> where
63 <italic>$ISE_EIFFEL</italic> represents the path to the EiffelStudio installation directory.
64 </item>
65 <item>
66 Make sure <bold>Generate and use marshaller DLL</bold> is not checked.
67 </item>
68 <item>
69 <link/>Click
70 <bold>Next</bold>.
71 </item>
72 <item>
73 In <bold>Component Type</bold>, choose
74 <italic>In-process (*.dll)</italic>.
75 </item>
76 <item>
77 In <bold>Generation Options</bold>, click the browse button and select the directory where the project should be created (later referenced as <italic>destination folder</italic>). Choose
78 <italic>$ISE_EIFFEL\examples\com\wizard\string_manipulator\generated\component</italic> where
79 <italic>$ISE_EIFFEL</italic> represents the path to the EiffelStudio directory.
80 </item>
81 <item>
82 Make sure both <bold>Compile C code</bold> and <bold>Compile Eiffel code</bold> are checked.
83 </item>
84 <item>
85 Make sure <bold>Clean destination folder prior to generation</bold> is selected.
86 </item>
87 <item>
88 Click <bold>Generate</bold>.
89 </item>
90 <item>
91 Wait until the wizard is done.
92 </item>
93 </list>
94 <heading>
95 <size>2</size> First look at the generated code
96 </heading>
97 <paragraph>
98 <link/>At the end of the processing the <bold>EiffelStudio</bold> button becomes enabled. Click on it. This will automatically start EiffelStudio with the generated project so you can more easily navigate through the created Eiffel classes. You can save the processing output by clicking the <bold>Save</bold> button.
99 </paragraph>
100 <paragraph>The deferred class
101 <class_name>STRING_MANIPULATOR_COCLASS</class_name> represents the component and exposes all its functionality. It inherits from
102 <class_name>ISTRING_INTERFACE</class_name> which corresponds to the
103 <bold>IString</bold> interface and has one heir
104 <class_name>STRING_MANIPULATOR_COCLASS_IMP</class_name> which implements all the deferred features. The default implementation in the heir is empty.
105 </paragraph>
106 <heading>
107 <size>2</size> Implementing the component
108 </heading>
109 <link/> To do something more interesting than merely returning an error to the client edit the implementation of the
110 <class_name>STRING_MANIPULATOR_COCLASS_IMP</class_name> class. There is an implementation of the class in
111 <italic>$ISE_EIFFEL\examples\com\wizard\string_manipulator\server</italic>\. Copy this file over to
112 <italic>$ISE_EIFFEL\examples\com\wizard\string_manipulator\generated\component\server\component</italic> and freeze the project. Voila!, you have your first EiffelCOM component up and running.
113 <heading>
114 <size>2</size> Running the component
115 </heading>
116 The component needs to be registered prior to being loaded. Register an out-of-process component using the following syntax:
117 <code_block>
118 system_name.exe -Regserver</code_block>
119 where <italic>system_name</italic> is the name of the component executable file. Register an in-process component using the
120 <italic>regsvr32</italic> utility using the following syntax:
121 <code_block>
122 regsvr32 system_name.dll</code_block>
123 where <italic>system_name</italic> is the name of the dll (e.g. string_manipulator). So to register the <class_name>
124 StringManipulator</class_name> component, run:
125 <code_block>
126 cd $ISE_EIFFEL\examples\com\wizard\string_manipulator\generated\component\server\EIFGEN\W_code
127 regsvr32 string_manipulator.dll</code_block>
129 Once registered, follow the steps described in <link><url>03_accessing.xml</url><label>Accessing a COM component</label></link>
130 to build the component's client.
131 <tip>
132 <bold>Tip</bold>:
133 <line_break/>
134 In development mode, the Eiffel compiler generates byte code that is required by the Eiffel runtime
135 in order to run the compiled system. The Eiffel runtime looks in the working directory for the byte code.
136 Since the client loads the EiffelCOM COM component from its current location, the
137 working directory will not contain the server's byte code. As a consequence when testing EiffelCOM COM components
138 the server's byte code must be copied to the working directory of the client.<line_break/>
139 For the <class_name>StringManipulator</class_name> component, the file
140 <italic>$ISE_EIFFEL\examples\com\wizard\string_manipulator\generated\component\server\EIFGEN\W_Code\string_manipulator.melted</italic>
141 must be copied to
142 <italic>$ISE_EIFFEL\examples\com\wizard\string_manipulator\client</italic>.
143 </tip>
144 <seealso>
145 <bold>See Also</bold>
146 <line_break/>
147 <link>
148 <url>02_new_from_eiffel.xml</url>
149 <label>Creating a new component from an Eiffel Project</label>
150 </link>
151 <line_break/>
152 <link>
153 <url>03_accessing.xml</url>
154 <label>Accessing a COM component.</label>
155 </link>
156 </seealso>
157 </paragraph></document>


Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23