473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to Implement Invoke for IDispatch

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
8 9526
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter Sparago | last post by:
I am working with the MSHTML editor control. I used win32com.client.gencache.EnsureModule on the MSHTML type library to generate the necessary IDispatch support for all the various interfaces used...
3
by: Roger That | last post by:
Hi, I am trying to use the function "CreateStreamOnHGlobal" from python code (I need to pass an IStream object to MSXML, like I do in C++ code). I was able to retrieve a pointer on the IStream...
1
by: Vic | last post by:
Hi all! I'm trying to create a DLL in C++ that calls an EXE containing a COM component. I load the component and call to it's methods using the IDispatch interface, it works correctly until I...
5
by: Dominic Godin | last post by:
Hi, I have decleared the IDispatch interface but I'm having trouble using it. Word.Application MSWord = new Word.ApplicationClass(); IDispatch wb = (IDispatch)MSWord.WordBasic; int lcid =...
4
by: Phil Coveney | last post by:
Hello, I am implementing a class in C# that wraps an automation server and am stuck on something basic. Using the following code fragment: using System; using System.Runtime.InteropServices;...
3
by: ATS | last post by:
HOWTO Implement LoadLibrary, GetProcAdress, and FreeLibrary. Below is code that I want to be able to use simple LoadLibrary\GetProcAddress\FreeLibrary technqiues on. I've used the code that was...
4
by: eselk | last post by:
I've got an out-of-process COM server (EXE) that I want to be able to control from Visual Basic. I can already control it from a C/C++ app without any issues. Under VBA in MS Access 2000, which I...
1
by: kernel1983 | last post by:
By reading the doc of pywin32 we can invoke COM like: o = win32com.client.Dispatch("Excel.Application") but is it possible to invoke some GUID directly?
3
by: Huayang Xia | last post by:
I am trying to use ctypes to call dll functions. One of the functions requires argument "struct IDispatch* ". I do have a PyIDispatch object in python. How can I convert this "PyIDispatch object"...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.