Finishing Up
We are now ready to wrap up our OCRServer component, but here are the last few steps required before a client can use this NT service:
Build the component.
Build the proxy/stub DLL using the nmake.exe utility.
Register the proxy/stub DLL using regsvr32.exe.
Register the service using the
-serviceoption.Optionally configure security as needed using the dcomcnfg.exe utility.
Start the service using the net.exe utility or using the
Servicesapplet in theControl Panel.
Recall that the proxy/stub makefile is generated by the ATL COM AppWizard. This makefile is named ProjectNameps.mk. In our case, our file is particularly named OCRServerps.mk. You can run this make file through the nmake.exe utility to create this DLL, as follows:
nmake -f OCRServerps.mk
Alternatively, you can add this as a custom build step under your project settings. The Project Settings dialog, which can be launched by selecting Settings under the Project menu, has a Post-build step property page that allows you to add this custom build step.
Whichever way you choose to build this DLL, its purpose is to marshal custom interfaces between the component and its remote clients. This DLL contains all the marshaling intelligence between the object and its clients. Notice that you have not written (and you’ll never have to write) a single line of marshaling code when using standard marshaling, since the interface proxy and stub are automatically generated based on the IDL file.
Technically, if we support only dual interfaces ...