Article ID: 107981 - Last Review: August 9, 2004 - Revision: 3.3

Picture It! 2001 Error Message: Picture It! Has Caused an Error in Module Lfcmp11n.dll

This article was previously published under Q107981

On This Page

Expand all | Collapse all

SUMMARY

SimpAuto.exe demonstrates how to create a simple OLE automation object.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
SimpAuto.exe (http://download.microsoft.com/download/ole/simpauto/3.51/w97/en-us/simpauto.exe)
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591  (http://support.microsoft.com/kb/119591/EN-US/ ) How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. 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 Microsoft Download Center 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 Run

The Hello object exposes the following:
   ProgID : SimpleAutomation.Hello
				
   Method and Property Names       Notes
   --------------------------------------------------------------
   HelloMessage  (prop)          Sets and returns string.
   SayHello    (method)          Displays HelloMessage in an edit
                                 control.
				
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:
   LocalServer = hello.exe -Automation
   win16 = hello.tlb
				
to something similar to the following:
   LocalServer = c:\source\simpauto\hello.exe -Automation
   win16 = c:\source\simpauto\hello.tlb
				

To Compile

Requires 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.
   File        Function
   ------------------------------------------------------------------------

   MAIN.CPP    Does initialization, creates main window, contains message
               retriever, and contains code that calls CreateStdDispatch.
   HELLO.CPP   Implements the HELLO object.
   HELLOCF.CPP Implements the HELLO class factory.
   HELLO.ODL   Object description Language that describes the property and
               method that HELLO exposes.
   HELLO.H     Defines the HELLO object and the class factory.
   TLB.H       Header file created by mktyplib.
   MAKEFILE    Makefile for project.
   VB.MAK,
   VB.FRM      Visual Basic project files to control this sample.
				

APPLIES TO
  • Microsoft OLE 2.03
  • Microsoft OLE 4.0, when used with:
    • Microsoft Windows NT 4.0
    • Microsoft Windows NT 3.51 Service Pack 5
    • Microsoft Windows 95
Keywords: 
kbdownload kbautomation kbfile kbsample KB107981
 

Article Translations