PRB: 16-bit AppWizard Doesn't Create .ODL Files

ID: Q141155

The information in this article applies to:

SYMPTOMS

Build an application using AppWizard and specify that it is an OLE server (full or mini) with OLE Automation support included. Notice that no Object Description Language (ODL) source file is generated.

AppWizard will not create an ODL file when generating a new application that supports OLE Automation. ClassWizard also won't create ODL files for new automation-enabled classes. This only applies to the 16-bit Visual C++ (1.x) products. AppWizard shipped with 32-bit versions of Visual C++ (2.x and 4.x) will create .odl files.

RESOLUTION

Following are two methods you can use to create an appropriate .odl file for a project that supports automation.

Using the first method, you will write the file from scratch using the information provided in the OLE Programmer's Reference Volume 2. The OLE SDK samples provided with Visual C++ contain two examples of .odl files:

Visual C++ 1.x does not provide any Object Description Language (ODL) scripts or type libraries for the MFC AUTOCLIK sample. However, the following Knowledge Base article does contain a sample ODL file for the MFC AUTOCLIK sample:

   ARTICLE-ID: Q132959
   TITLE     : SAMPLE: An ODL File for 16-bit AUTOCLIK

The second method requires less manual work. If you have Visual C++ 2.x or 4.x installed, you can generate an AppWizard OLE Automation server and use the resulting .odl source script as a starting point for your 16-bit project. Following are the basic steps for doing this:

1. Generate an AppWizard project in Visual C++ 2.x or 4.x, selecting OLE

   Automation support.

2. Copy the resulting .odl file from the new project to your 16-bit project
   directory, changing the name of the file to the 16-bit project name.

3. Edit the .odl file in the 16-bit project.

4. Correct the document class name wherever it appears. This means the

   "//{{AFX_ODL_..." type comments as well.

5. Look for an "Ixxxxx" name where xxxxx is a document name; change it to
   reflect the document class name.

6. Generate two new GUIDs. GUIDs can be generated by using the Guidgen.exe
   tool located in your Msvc\Bin directory. The first GUID should be used
   to replace the GUID already occupying the "uuid" attribute in front of
   the "library" section in the .odl file. The second GUID should be used
   to replace the GUID in the "uuid" attribute in front of the
   "dispinterface" section.

7. Copy the CLSID for the existing 16-bit document class into the "uuid"
   attribute of the "coclass" section, replacing the GUID that was there.
   The CLSID for your project's document class can be found in the .reg
   file that AppWizard generated for your project.

8. Add new Automation-enabled classes. The ClassWizard will automatically
   update the .odl file with appropriate "coclass" and "dispinterface"
   sections.

REFERENCES

OLE 2 Programmer's Reference, volume 2, Chapter 7, "Object Description Language"

Additional query words: object description classwizard type library libraries

Keywords          : kbole kbtshoot kb16bitonly kbCtrl 
Version           : 1.0 1.5 1.51 1.52 1.52b
Platform          : WINDOWS
Issue type        : kbprb

Last Reviewed: August 11, 1997