By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,245 Members | 1,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,245 IT Pros & Developers. It's quick & easy.

How to Implement Invoke for IDispatch

P: n/a
Hi guys

There's nothing much going on in Interop at the moment, so I'll post this
here as well in case someone can give me a quick answer.

The following is an extract from MSDN:

<extract>
*** Setting the Ambient User Mode on the WebBrowser Object ***

To set the ambient user mode on the WebBrowser object, first QI the
IWebBrowser2 interface for the IOleControl interface and then call
IOleControl::OnAmbientPropertyChange, passing DISPID_AMBIENT_USERMODE as the
argument.
m_pIWebBrowser2->QueryInterface( IID_IOleControl, (void**)&pIOleCtrl );
pIOleCtrl->OnAmbientPropertyChange( DISPID_AMBIENT_USERMODE );

This causes MSHTML to call IDispatch::Invoke on the host application,
passing along the same DISPID. Of course, for this to work, the host
application has to handle the DISPID_AMBIENT_USERMODE case in its
IDispatch::Invoke implementation, returning VARIANT_TRUE in the pvarResult
parameter to activate the editor or VARIANT_FALSE to deactivate it.
</extract>

My question is, how can my (VB.NET) application implement IDispatch::Invoke
in order to test for the DISPID and return the correct value?

TIA

Charles

Nov 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Hi Everybody,

Now hold on, don't all crowd round to answer this one - form an orderly
queue - you'll all get your turn.

Sorry Charles, couldn't resist. ;-D

Regards,
Fergus
Nov 20 '05 #2

P: n/a
Now look what you've done. They all think that an answer was posted, so no
one is answering.

;-)

Charles
MVP [All things, bright and beautiful]
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi Everybody,

Now hold on, don't all crowd round to answer this one - form an orderly queue - you'll all get your turn.

Sorry Charles, couldn't resist. ;-D

Regards,
Fergus

Nov 20 '05 #3

P: n/a
Hi Charles,

Take a wander through the System.Runtime.InteropServices Namespace.
There's mention there of IDispatch, DispIds, IDispatchImpls and all sorts of
stuff which is meaningless to your non-C++ programmer. It sounds like you know
what you're talking about - and therefore what you're looking for.

Good luck. :-)

Regards,
Fergus
Nov 20 '05 #4

P: n/a
Hi Charles,

|| They all think that an answer was posted ...

Oops, sorry - that is a possibility. :-(

But I think that extract is more frightening than the Google Man!! 8-O

Actually, C# suffers the same constraints as VB.NET as regards Interop
because it's the Framework more than the language. But the C# crowd will have
a lot of C++/COM people. It might be useful to post to languages.csharp as
well (oh, and leave out the VB word from your query, wink, wink - they're a
delicate lot)

;-)

Regards,
Fergus
Nov 20 '05 #5

P: n/a
Good tip. Nods as good as a wink to a blind bat.

Charles
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:eH**************@TK2MSFTNGP12.phx.gbl...
Hi Charles,

|| They all think that an answer was posted ...

Oops, sorry - that is a possibility. :-(

But I think that extract is more frightening than the Google Man!! 8-O
Actually, C# suffers the same constraints as VB.NET as regards Interop
because it's the Framework more than the language. But the C# crowd will have a lot of C++/COM people. It might be useful to post to languages.csharp as
well (oh, and leave out the VB word from your query, wink, wink - they're a delicate lot)

;-)

Regards,
Fergus

Nov 20 '05 #6

P: n/a
Thanks, I will. But for now, the sandman beckons.

Tara a bit.

Charles
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
Hi Charles,

Take a wander through the System.Runtime.InteropServices Namespace.
There's mention there of IDispatch, DispIds, IDispatchImpls and all sorts of stuff which is meaningless to your non-C++ programmer. It sounds like you know what you're talking about - and therefore what you're looking for.

Good luck. :-)

Regards,
Fergus

Nov 20 '05 #7

P: n/a
Cor
Hi Charles,
You know that I had to a lot of problems with axWebbrowser.
What I do than is delete it totaly and just start again.
And then I was never able to recreate the errors I had.
(Until I start moving with it inside my code and get other strange errors)
I was always thinking that it has to do with the registration of the
webbrowser in the registry,
(That is somewhere written), but never took some time to look what that
means.
Did you?
Cor
Nov 20 '05 #8

P: n/a
Hi Cor

I haven't looked, but you may have something there because Fergus says his
did not give the same problem on the EndInit() call, I think. I have tried
it on one other machine where it did do the same, but I will look to see if
I can find any info. on the registration.

Cheers

Charles
"Cor" <no*@non.com> wrote in message
news:3f***********************@reader20.wxs.nl...
Hi Charles,
You know that I had to a lot of problems with axWebbrowser.
What I do than is delete it totaly and just start again.
And then I was never able to recreate the errors I had.
(Until I start moving with it inside my code and get other strange errors)
I was always thinking that it has to do with the registration of the
webbrowser in the registry,
(That is somewhere written), but never took some time to look what that
means.
Did you?
Cor

Nov 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.