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:

  1. Build the component.

  2. Build the proxy/stub DLL using the nmake.exe utility.

  3. Register the proxy/stub DLL using regsvr32.exe.

  4. Register the service using the -service option.

  5. Optionally configure security as needed using the dcomcnfg.exe utility.

  6. Start the service using the net.exe utility or using the Services applet in the Control 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 ...

Get Learning DCOM now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.