IDispatch - how to check if it's still valid or a Null IDispatch

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

IDispatch - how to check if it's still valid or a Null IDispatch

Günther Schmidt
Hi all,

I'm creating an Excel application IDispatch within a singleton. I also
need to check wether or not that "Application" is still alive or wether
it's a null IDispatch.

How do I do that?

Thanks

Günther


PS:

Bill if you read this I got myself VBA for Dummies this morning and
start doing it the way you suggested (by hand basically).


Reply | Threaded
Open this post in threaded view
|

Re: IDispatch - how to check if it's still valid or a Null IDispatch

Schwab,Wilhelm K
Günther,

> I'm creating an Excel application IDispatch within a singleton. I also
> need to check wether or not that "Application" is still alive or wether
> it's a null IDispatch.
>
> How do I do that?

Is there an #isNull method somewhere?  However, I wonder whether that
the way should approach it (just brainstorming).  Can't you control the
life of the Excel application?  If you don't let the top level IDispatch
out of your sight, and you make the Excel window(s) invisible to the
user, then you are probably able to control it rather than the other way
around.  See WordAutomation>>stop, and #visible:.  Hopefully Excel works
the same way.


> Bill if you read this I got myself VBA for Dummies this morning

I am _certain_ that much is a good move.  It's a very useful book.


 > and
> start doing it the way you suggested (by hand basically).

Follow, if not extend my Word package.  The advantage being that you
will end up with a small number of classes that are easily browsable.
They won't do everything, but can grow over time.  Further, by
incrementally devloping them as you read VBA for Dummies, you will get
all of the "this comes from a property you get from calling that method
of that other thing after iteration this collection with is a property
of such and such" right, and then (hopefully) never have to think about
it again.

BTW, the type library analyzer is a great tool.  Keep in mind that Blair
had to write all of those type library structs by hand (yikes!), and it
becomes all the more impressive.  So far, Office is the only thing I can
think of where I avoid it, for reasons already stated, and which I think
you are starting to appreciate.  If you later decide I gave you a bum
steer, speak up.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: IDispatch - how to check if it's still valid or a Null IDispatch

Günther Schmidt
Dear Bill,

Bill Schwab schrieb:

> Günther,
>
>> I'm creating an Excel application IDispatch within a singleton. I also
>> need to check wether or not that "Application" is still alive or
>> wether it's a null IDispatch.
>>
>> How do I do that?
>
>
> Is there an #isNull method somewhere?  However, I wonder whether that
> the way should approach it (just brainstorming).  Can't you control the
> life of the Excel application?  If you don't let the top level IDispatch
> out of your sight, and you make the Excel window(s) invisible to the
> user, then you are probably able to control it rather than the other way
> around.  See WordAutomation>>stop, and #visible:.  Hopefully Excel works
> the same way.
>

Well I just found out about the isNull ;-)

I'm using singletons so I avoid running multiple Excel Applications. I'm
using isNull because the singletons kind of stay persistent over
shutting down and restarting Dolphin but the actual Excel application
does not.



>
>> Bill if you read this I got myself VBA for Dummies this morning
>
>
> I am _certain_ that much is a good move.  It's a very useful book.
>
>
>  > and
>
>> start doing it the way you suggested (by hand basically).
>
>
> Follow, if not extend my Word package.  The advantage being that you
> will end up with a small number of classes that are easily browsable.
> They won't do everything, but can grow over time.  Further, by
> incrementally devloping them as you read VBA for Dummies, you will get
> all of the "this comes from a property you get from calling that method
> of that other thing after iteration this collection with is a property
> of such and such" right, and then (hopefully) never have to think about
> it again.
>
> BTW, the type library analyzer is a great tool.  Keep in mind that Blair
> had to write all of those type library structs by hand (yikes!), and it
> becomes all the more impressive.  So far, Office is the only thing I can
> think of where I avoid it, for reasons already stated, and which I think
> you are starting to appreciate.  If you later decide I gave you a bum
> steer, speak up.
>
> Have a good one,
>
> Bill
>

Thanks Günther