PRB: Building 16-Bit OLE Control on a Dual-Boot Computer

ID: Q131043

The information in this article applies to:

SYMPTOMS

Having installed the 16-bit version of the CDK on a dual-boot computer capable of running Windows NT (or Windows 95) and Windows version 3.1x, you may encounter problems attempting to build the type library for your OLE Custom Control under Windows version 3.1x. Choosing Make TypeLib from the Tools menu may briefly display an MS-DOS window with this message:

   Project can only be run in Windows.

CAUSE

When running the CDK setup program under Windows NT or Windows 95, the Make TypeLib menu command is configured to execute a batch file called BLDTYPLB.BAT. This batch file executes the MKTYPLIB.EXE utility to build the project's type library. Because Windows programs cannot be executed directly from the MS-DOS command prompt under Windows version 3.1x, the error message is displayed. Under Windows NT and Windows 95, Windows programs can be launched directly from the MS-DOS command prompt.

RESOLUTION

To readily build your 16-bit OLE Custom Control project from Windows NT (or Windows 95) and Windows version 3.1x, add an additional menu item to your tools menu by using the Tools dialog box (choose Tools from the Options menu).

For Windows version 3.x, configure a Tools menu item with these settings:

Command Line     : C:\MSVC\BIN\MKTYPLIB.EXE
Menu Text        : Make TypeLib &Win16
Arguments        : /cpp_cmd C:\MSVC\BIN\cl /W0 /I C:\MSVC\CDK16\INCLUDE
                   /nologo $Proj.odl /tlb tlb16\$Proj.tlb
Initial Directory: $ProjDir

For Windows NT and Windows 95, configure another Tools menu item with these settings:

Command Line     :  C:\MSVC\CDK16\BLDTYPLB.BAT
Menu Text        :  Make Type&Lib Win32
Arguments        :  $Proj.ODL C:\MSVC\BIN $Proj.Dir
                    C:\MSVC\CDK16\INCLUDE
Initial Directory: $ProjDir

When running Visual C++ version 1.5x under Windows version 3.1x, use the "Make TypeLib Win16" menu item to build the project's type library. When running under Windows NT or Windows 95, use the "Make TypeLib Win32" menu item.

REFERENCES

For additional information on the Tools dialog box, please see the Visual C++ Help file or User's Guide.

Keywords          : kbole kb16bitonly kbCtrl 
Version           : 1.51.152

Last Reviewed: August 10, 1997