HOWTO: Use OLE Automation from a C Application Rather Than C++ (181473)
The information in this article applies to:
- Microsoft Excel 2000
- Microsoft Visual C++ 4.0
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Excel 2002
- Microsoft Excel 97 for Windows
This article was previously published under Q181473 SUMMARY
If you need to program in C, rather than C++, OLE Automation can be
difficult because the Component Object Model (COM), the building blocks of
OLE, was designed around the binary layout of a C++ class. The header files
included by WINDOWS.H, however, have built-in support for C compilations;
therefore, you can mimic the behavior of a C++ object and make OLE
Automation calls. This article describes how to build a Win32 console
application, using C, that starts up Microsoft Excel and makes it visible
via OLE Automation.
REFERENCES
For more general information regarding OLE, COM, and Automation, consult
the book "Inside OLE" by Kraig Brockschmidt (Microsoft Press).
For more information about IDispatch, consult the Microsoft Visual C++
online help.
For more information about COM, OLE, and automating Microsoft Excel using
Microsoft Visual C++, see Chapters 23-27 of the book "Inside Visual C++" by
David J. Kruglinski (Microsoft Press).
(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Joe Crump, Microsoft Corporation.
Modification Type: | Minor | Last Reviewed: | 3/21/2005 |
---|
Keywords: | kbhowto KB181473 |
---|
|