SAMPLE: Demo of Simple C Automation Component and Controller (138470)



The information in this article applies to:

  • Microsoft OLE Libraries, when used with:
    • the operating system: Microsoft Windows NT 3.5
    • the operating system: Microsoft Windows NT 3.51
    • the operating system: Microsoft Windows NT 4.0
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 2000

This article was previously published under Q138470

SUMMARY

The Cautoex samples illustrate how to write a simple OLE Automation component (Cauto) and simple Automation controller (Cautocon) in C.

The following file is available for download from the Microsoft Download Center:
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 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.

NOTE: After downloading Cautoex.exe, use the -d option to extract the files so that they go into the correct directory structure. In other words, place Cautoex.exe in an empty directory, and run it by using this command:

cautoex -d

MORE INFORMATION

Cautoex.exe contains the following two sample applications:

  • Cauto is a local OLE Automation component sample application written in C. It contains a dialog box that prompts for text and a position to display that text on the main window. It exports, using OLE Automation, the text property as well as methods to get and set the position of the text and to refresh the main window of the component. A dual interface is used to support all of the automation. This dual interface is described in the object definition language file CAUTO\cauto.odl. IDispatch::GetIdsOfNames and IDispatch::Invoke simply call DispGetIDsOfNames and DispInvoke respectively.
  • Cautocon is a simple OLE Automation controller written in C that controls the Cauto application. There is a dialog that prompts for text and position. Cautocon then uses OLE Automation to draw that text at the appropriate position on the component's main window. This dialog box is activated by clicking Set on the Text menu. It is loaded with the text and position from the component's main window each time it is activated.

Modification Type:MinorLast Reviewed:8/9/2004
Keywords:kbdownload kbAutomation kbfile kbSample KB138470 kbAudDeveloper