Click to See Complete Forum and Search --> : HELP!!!:How can I accuire IDispatch


rick
April 8th, 1999, 01:29 PM
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

Rick
April 8th, 1999, 01:29 PM
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

Masaaki
April 8th, 1999, 11:26 PM
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-

Masaaki
April 9th, 1999, 11:28 PM
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-

rick
April 12th, 1999, 03:26 PM
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

Rick
April 12th, 1999, 03:26 PM
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

Masaaki
April 12th, 1999, 06:55 PM
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);
};