How to Register an MFC OLE Automation Server to Avoid FailureLast reviewed: October 10, 1997Article ID: Q137516 |
2.00 2.10 2.20
WINDOWS NT
kbole kbenv kbtshoot
The information in this article applies to:
The AppWizard, included with: - Microsoft Visual C++, 32-bit Edition, version(s) 2.00 2.10 2.20
SUMMARYCreation of an OLE Object may fail if the registry file (.reg) generated by AppWizard is used to register the server for the object. This article explains how to avoid this failure.
MORE INFORMATIONRegistration of an MFC OLE Automation server typically occurs when running the server stand-alone for the first time. An alternate way of registering the server is to run the registration editor and merge the .reg file generated by AppWizard for the server's project. This method is necessary if the server is installed but not run before a client tries to create it. It is necessary that the setup program that installs the server also replace any occurrence of the executable in the .reg file with the fully- qualified path and file name of the executable. When AppWizard creates the .reg file for the project, AppWizard does not know what the final path to the executable will be. Therefore, AppWizard cannot fill in the fully qualified path name for the server. If the .reg file provided by the AppWizard is used as is to register the server for an object, OLE won't be able to find the server, creation of the object will fail, and OLE will return the error CO_E_SERVER_EXEC_FAILURE.
Sample CodeThe following is an example of the \LocalServer key for the AutoClik, Step 1 sample as generated by AppWizard: HKEY_CLASSES_ROOT\CLSID\{2106E720-AEF8-101A- 9005-00DD0108D651}\LocalServer = AUTOCLIK.EXEAfter being setup correctly, the \LocalServer key in the .reg file may appear as follows: HKEY_CLASSES_ROOT\CLSID\{2106E720-AEF8-101A- 9005-00DD0108D651}\LocalServer = C:\MSVC20\SAMPLES\MFC \autoclik\step3\WinDebug\AUTOCLIK.EXE |
Additional reference words: kbinf 2.00 2.10 2.20 3.00 3.10 3.20
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |