Office Automation using MFC Application

Discussion in 'Computer Support' started by virajajgaonkar@gmail.com, May 27, 2005.

  1. Guest

    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 apllication
    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.

    http://www.mobiliti.com
    , May 27, 2005
    #1
    1. Advertising

  2. Duane ;-\) Guest

    <> wrote in message
    news:...
    > 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 apllication
    > 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?


    You may be able to get some help at that NG.

    comp.os.ms-windows.programmer.tools.mfc

    I have not worked with the particular method and I don't know why you're
    using Interfaces but you may be able to do it simple as in the link with
    whatever language you are using.

    http://tinyurl.com/8cx5v


    Duane :)
    Duane ;-\), May 27, 2005
    #2
    1. Advertising

  3. Guest

    Hello Duane,

    Thanks a lot for the help. The example in the link above is in vb. My
    application is MFC application using VC. In VB we can directly
    instansiate objects of the class Word.Document and Word.Application.
    However in VC we can instantiate only Word.Application and not
    Word.Document. The method i need to use (CompareSideBySideWith) cannot
    be called using Word.Application. We need either Word.Document or
    Windows object to cal this method. Both these classes are inaccessible
    in VC++. So it's kind of a deadlock.

    Thanks,
    Viraj
    Mobiliti Inc.

    http://www.mobiliti.com
    , May 29, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aleks

    Word automation

    Aleks, Jun 10, 2004, in forum: Microsoft Certification
    Replies:
    1
    Views:
    471
    Dthmtlgod
    Jun 10, 2004
  2. =?Utf-8?B?d2VicnVubmVy?=

    WebRunner Automation

    =?Utf-8?B?d2VicnVubmVy?=, May 20, 2004, in forum: MCSD
    Replies:
    2
    Views:
    465
    The Poster Formerly Known as Kline Sphere
    May 20, 2004
  3. JM

    CD Ripping Automation Question

    JM, Nov 9, 2004, in forum: Computer Support
    Replies:
    2
    Views:
    544
    dadiOH
    Nov 9, 2004
  4. Office Automation using MFC

    , Jun 2, 2005, in forum: Computer Support
    Replies:
    0
    Views:
    534
  5. PAUL KOUKOS

    WordPad MFC Application

    PAUL KOUKOS, Dec 9, 2006, in forum: Computer Support
    Replies:
    2
    Views:
    4,269
Loading...

Share This Page