Office Automation using MFC

Office Automation using MFC

Post by virajajgao » Sun, 29 May 2005 05:39:28


Hello All,

My aim is to have a MFC application which takes two word file names as
input. Then it opens these two word files in ms word application
windows for comparing side by side with eachother. This is also known
as Office Automation. I am trying to use the dynamic approach.
The Dynamic approach:
1) Get class id of the required class.
2) Using "CoCreateInstance" create an instance of this class. This
also returns a pointer to the Unknown Interface.
3) Using the "QuerryInterface" and pointer to Unknown Interface get
a pointer to the Dispatch Interface.
4) If any further interface is needed use "QuerryInterface" and the
pointer to Dispatch Interface get a pointer to the Required Interface.
5) Use the final Interface Pointer and "GetIDsOfNames", to get
DispatchId of the required function.
6) Use the DispatchId and final Interface Pointer to "Invoke" this
function.

The method I need to use is "CompareSideBySideWith". This method
can be accessed only by an object of "Windows" class or
"Word.Document" class. The class id of the class "Windows" is
not available hence I have to use the class "Word.Document".

Using the class "Word.Document", I am able to get till step 4, i.e.
I am able to get a pointer to it's Dispatch Interface. In step 5 it
does not return any Dispatch id for "CompareSideBySideWith" method.
In the msdn documentation it is mentioned that
"CompareSideBySideWith" is a method of that class. No documentation
can be found to check if there are any intermediate interface between
the "Dispatch" and the required method.
Can anyone please tell me where I am going wrong?

Thanks,
Viraj
Mobiliti Inc.
XXXX@XXXXX.COM
http://www.yqcomputer.com/