The information in this article applies to:
SUMMARYSimpAuto.exe demonstrates how to create a simple OLE automation object. MORE INFORMATIONThe following file is available for download from the Microsoft
Download Center. Click the file name below to download the file: SimpAuto.exeFor more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. SimpAuto.exe implements a simple OLE automation object called Hello that exposes one property, HelloMessage, and one method, SayHello. It uses an OLE-provided IDispatch implementation that is created using CreateStdDispatch. The interface that SIMPAUTO exposes is described using an object description language (HELLO.ODL). The mktyplib tool is used to create a type library (HELLO.TLB) from HELLO.ODL. CreateStdDispatch() is then used to implement an IDispatch interface using the interface description in the type library. SimpAuto.exe registers a class factory if it is started with the - Automation command-line switch. OLE uses this classfactory to create a Hello object. Automation controllers uses the IDispatch interface exposed by the Hello object to access its property and method. The AUTODLL sample in the Software Library demonstrates the implementation of an inproc automation object with the same methods and properties as SIMPAUTO, but which is a DLL. The main differences between the two samples are in the MAIN.CPP file. To RunThe Hello object exposes the following:
Update the HELLO.REG file in two places to include the full path
information to the HELLOEXE and the HELLO.TLB files. Change the lines from
the following:
to something similar to the following:
To CompileRequires OLE 2.01 or later.Include device=vmb.386 in the [386Enh] section of SYSTEM.INI. Note that vmb.386 can be found in \OLE2\BIN. Run the WXSRVER.EXE from \OLE2\BIN before running the makefile.
Additional query words:
Keywords : kbfile kbsample kbAutomation kbNTOS350 kbNTOS351 kbOLE200 kbWinOS95 |
Last Reviewed: December 7, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |