Solved

Using OLE Automation Objects

Posted on 1999-01-20
5
228 Views
Last Modified: 2013-11-25
I am integrating a product called BackWeb which is an OLE Automation Object in the form of an .exe.  How do I import or use an object like this?  In the OLE/COM viewer I can see the Object as an Active Template Library but I can't find out how to use it.

Thanks,
  Blake
0
Comment
Question by:bjstorey
  • 3
  • 2
5 Comments
 

Author Comment

by:bjstorey
ID: 1328037
Adjusted points to 150
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 150 total points
ID: 1328038
You can use #import on an .EXE and it will try to generate the wrappers for it if and only if there is type library information in the .EXE.

If there isn't then you will need to build it yourself. In which case, using COleDispatchDriver is your best friend. Take a look at the documentation for the class on how to use it. There are samples that shipped with MFC that use this class: CalcDriv and ACDual.


0
 

Author Comment

by:bjstorey
ID: 1328039
That imported the information but how do I actually call one of these objects.  I have tried CoCreateInstance but I can't get the right Interface ID
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1328040
You need to use

  IDispatch* dispatch = NULL;
  HRESULT hr = CoCreateInstance(clsId, NULL, CLSCTX_SERVER, IID_IDispatch, (void**)&dispatch);

The clsId is available through the registry or using CLSIDFromProgID().
0
 

Author Comment

by:bjstorey
ID: 1328041
Thanks again...I have that now also.  I have a specific Interface I want to get now called IBackWeb.  How do I get at that interface?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question