In order to run your application as an OLE server, you need to register it with Windows. AppWizard provides code that does this for you when you simply run the application, as you saw in Previewing Scribble Running as an OLE Server. AppWizard also provides a text file, Scribble.reg, which you can use to register Scribble as an OLE server. You do this by running REGEDIT and merging Scribble.reg with the existing Windows registry file.
To use REGEDIT to register Scribble as an OLE server
If you’re going to distribute your application, you should provide this registration as part of the application setup routine.
There are several ways you can do this:
regedit /s scribble.reg
Naturally, you’d need to create and maintain a .REG file specific to your particular application.
scribble /register
Of course, you'd need to modify your application's InitInstance
code so that it recognizes this special switch. This works well for applications that are small and boot relatively quickly, since you can leverage the automatic registration that MFC provides as part of the framework.
For more information, see Framework Support for Registering the Application with Windows later in this lesson.