CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 1999
    Location
    Ottawa, Ont
    Posts
    120

    HELP!!!:How can I accuire IDispatch

    The question is how can I accuire an IDispatch from an application that is already in existance?

    eg.
    opened up Word and want to get the IDispatch for it.

    Thanks

    Rick


  2. #2
    Join Date
    May 1999
    Location
    Ottawa, Ont
    Posts
    120

    HELP!!!:How can I accuire IDispatch

    The question is how can I accuire an IDispatch from an application that is already in existance?

    eg.
    opened up Word and want to get the IDispatch for it.

    Thanks

    Rick


  3. #3
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: Probably, impossible

    Hi, Rick.

    So far, I have explorerd MSDN help, but I can't find how
    we catch IDispatch of Word opened already.
    So, I think that it is impossible to catch IDispatch.
    Therefore, To catch IDispatch is only way to open Word in OLE Automation program, I guess this time.

    I guess that you want to write the program to detect Macro virus
    like "Melissa". If so, you may change your approach that if the
    customer click Word attached in Email, Word will be opended through
    OLE Automation program.
    However, I have no clue of how to write it?

    Regards.
    -Masaaki Onishi-


  4. #4
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: I got some clue.

    Hi.

    Today, when I am working my project of Excel Automation Loop,
    I got some clue.

    Before, when we open blank Word, this Word will get word sheet
    in the same Word when we click Work document at Window Exploer as well
    as Email.

    So we open this blank Word in Word Automation, we can catch this
    IDispatch. If this Word gets the word sheet, I guess that we can
    use LDISPATCH GetItem(VARIANT &Index) in Worker Thread or Timer.
    However, I just work Excel Automation, so I didn't check it yet.

    Hope for help.
    -Masaaki Onishi-


  5. #5
    Join Date
    May 1999
    Location
    Ottawa, Ont
    Posts
    120

    Re: I got some clue.

    Thanks for the help...

    but I'm not shure where you get
    LDISPATCH GetItem(VARIANT &Index) form I looked in all the help that I could find but I found not reference to that particular function can you elaberate on its use?

    Thanks again Masaaki..

    Rick


  6. #6
    Join Date
    May 1999
    Location
    Ottawa, Ont
    Posts
    120

    Re: I got some clue.

    Thanks for the help...

    but I'm not shure where you get
    LDISPATCH GetItem(VARIANT &Index) form I looked in all the help that I could find but I found not reference to that particular function can you elaberate on its use?

    Thanks again Masaaki..

    Rick


  7. #7
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: I got some clue.

    Hi, Rick.

    When you make the wrapped class called Excel8.h from Excel8.tlb
    you will get LPDISPATCH GetItem(const VARIANT& Index).
    Also, check how we open Word in Applicaiton from MS support page.

    Regards.
    -Masaaki Onishi-
    This is a part of Excel8.h
    /////////////////////////////////////////////////////////////////////////////
    // Workbooks wrapper class

    class Workbooks : public COleDispatchDriver
    {
    public:
    Workbooks() {}// Calls COleDispatchDriver default constructor
    Workbooks(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
    Workbooks(const Workbooks& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}

    // Attributes
    public:

    // Operations
    public:
    LPDISPATCH GetApplication();
    long GetCreator();
    LPDISPATCH GetParent();
    LPDISPATCH Add(const VARIANT& Template);
    void Close();
    long GetCount();
    LPDISPATCH GetItem(const VARIANT& Index);//here
    LPUNKNOWN Get_NewEnum();
    LPDISPATCH Open(LPCTSTR Filename, const VARIANT& UpdateLinks, const VARIANT& ReadOnly, const VARIANT& Format, const VARIANT& Password, const VARIANT& WriteResPassword, const VARIANT& IgnoreReadOnlyRecommended, const VARIANT& Origin,
    const VARIANT& Delimiter, const VARIANT& Editable, const VARIANT& Notify, const VARIANT& Converter, const VARIANT& AddToMru);
    void OpenText(LPCTSTR Filename, const VARIANT& Origin, const VARIANT& StartRow, const VARIANT& DataType, long TextQualifier, const VARIANT& ConsecutiveDelimiter, const VARIANT& Tab, const VARIANT& Semicolon, const VARIANT& Comma,
    const VARIANT& Space, const VARIANT& Other, const VARIANT& OtherChar, const VARIANT& FieldInfo, const VARIANT& TextVisualLayout);
    LPDISPATCH Get_Default(const VARIANT& Index);
    };


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured