ATL ActiveX Controls

In this section, we will use ATL to build an in-process server that supports a simple ActiveX control. We will call the in-process server ATLCyberServer and our ActiveX control ATLCyberOcr. ATLCyberOcr allows people across the globe to perform OCR processing. It allows a user to select an image from disk storage and requests OCR processing on the selected image. When asked to perform OCR processing, the ATLCyberOcr ActiveX control will delegate the task to the back-end OCRServer component that was built in Chapter 6.

In addition to this functionality, we will also learn how to attach proxy/stub code into the ATLCyberServer component that we’re building to mitigate the setup and registration pain during component download.

Creating the Project

Let’s start off by creating the project as directed in the following steps:

  1. Use the ATL COM AppWizard to create a new project. Name this project ATLCyberServer and click OK to proceed.

  2. In Step 1 of the ATL COM AppWizard, select DLL as the Server Type.

  3. Check the Allow merging of proxy/stub code check-box, so that the proxy/stub code will be merged into the resulting DLL. This is important for an ActiveX control that is downloaded across cyberspace. Recall that if the threading models of the in-process server and the hosting out-of-process server differ, marshaling will result. In order to successfully standard marshal a custom interface, you must provide and register its proxy/stub code. Selecting this option will automatically ...

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.