SAMPLE: AutoCtrl.exe - OLE Automation Controller Sample (106080)
The information in this article applies to:
- Microsoft OLE Libraries for Windows and Win32s 2.0
- 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 95
This article was previously published under Q106080 SUMMARY AutoCtrl.exe demonstrates how to create an OLE automation
controller. MORE INFORMATIONThe
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.
This OLE automation controller sample
demonstrates how to create an OLE automation object and how to access its
properties and methods. Creating an Automation Object [CreateObject() in file AUTOCTRL.CPP.] The user is
prompted for the ProgID of the automation object to be created. CLSIDFromProgID
is used to obtain the CLSID of the object; CoCreateInstance is used to create
the object. Accessing Properties and Methods IDispatch::GetIDsOfNames is used to obtain the ID of the property
or method to be accessed; IDispatch::Invoke is used to access the property or
method. This controller prompts the user for the locale ID; however, many
controllers such as Visual Basic use the default system locale ID. Setting a Property [See SetProperty() in AUTOCTRL.CPP.] The user is
prompted for the property name, property value, property type and locale ID.
This controller supports three types: VT_BSTR, VT_I2 and VT_R4. Setting the
property requires an implicit named parameter, which represents the new value
of the property. The DISPID of this implicit named parameter is
DISPID_PROPERTYPUT. Getting a Property [See GetProperty() in AUTOCTRL.CPP.] The user is
prompted for the property name, property type, and locale ID. Invoking a Method [See InvokeMethod() in AUTOCTRL.CPP.] The user is
prompted for the method name and the locale ID. This controller supports only
methods without parameters.
Modification Type: | Minor | Last Reviewed: | 8/10/2004 |
---|
Keywords: | kbAutomation kbfile kbSample KB106080 kbAudDeveloper |
---|
|