com >> IDispatch: Can an additional parameter added in IDispatch GetIDsOf

by QmFiYXIgSWZ0aWtoYXIgTWFsaWs » Tue, 14 Mar 2006 18:33:06 GMT

I want to make a call to IDispatch GetIDsofNames and IDispatch Invoke from
one COM exe to another COM exe (in which the implementaion of these two
methods is being done). The second COM exe is an automation wrapper. In doing
so I want to pass an argument (BSTR) to IDispatch GetIDsOfNames and Invoke
from the caller exe so that i can preserve my thread pool design. e.g I need
to do the following

STDMETHOD (GetIDsOfNames)(REFIID riid, LPOLESTR* rgszNames, UINT cNames,LCID
lcid,DISPID* rgdispid, BSTR sessionID );

STDMETHOD ( Invoke )( DISPID dispidMember, REFIID riid, LCID lcid, WORD
wFlags, DISPPARAMS* pDispparams, VARIANT* pVarResult, EXCEPINFO* pExcepinfo,
UINT* puArgErr, BSTR sessionID);

Can some body tell me the exact signature to be used in my IDL for GetIDsOf
Name and Invoke.



com >> IDispatch: Can an additional parameter added in IDispatch GetIDsOf

by Anthony Jones » Thu, 16 Mar 2006 17:03:54 GMT



"Babar Iftikhar Malik" < XXXX@XXXXX.COM > wrote

doing
need
cNames,LCID
pExcepinfo,
GetIDsOf

[
odl,
uuid(00020400-0000-0000-C000-000000000046),
restricted
]
interface IDispatch : IUnknown {
[restricted]
HRESULT _stdcall GetTypeInfoCount([out] unsigned int* pctinfo);
[restricted]
HRESULT _stdcall GetTypeInfo(
[in] unsigned int itinfo,
[in] unsigned long lcid,
[out] void** pptinfo);
[restricted]
HRESULT _stdcall GetIDsOfNames(
[in] GUID* riid,
[in] char** rgszNames,
[in] unsigned int cNames,
[in] unsigned long lcid,
[out] long* rgdispid);
[restricted]
HRESULT _stdcall Invoke(
[in] long dispidMember,
[in] GUID* riid,
[in] unsigned long lcid,
[in] unsigned short wFlags,
[in] DISPPARAMS* pdispparams,
[out] VARIANT* pvarResult,
[out] EXCEPINFO* pexcepinfo,
[out] unsigned int* puArgErr);
};

Of course you're going to create and addtional couple of members on an
interface derived from IDispatch right?

Anthony.





Similar Threads

1. C++ IDispatch** vs. VB Object

2. Help on IDispatch Invoke Handler in VB.NET

3. Implementing IDispatch for Webbrowser.....

How would I implement the IDispatch interface to handle the following in 
VB.Net

<BEGIN>
Controlling Download and Execution
The WebBrowser Control gives you control over what it downloads, displays, 
and executes. To gain this control, you need to implement your host's 
IDispatch so it handles DISPID_AMBIENT_DLCONTROL. When the WebBrowser 
Control is instantiated, it will call your IDispatch::Invoke with this ID. 
Set pvarResult to a combination of following flags, using the bitwise OR 
operator, to indicate your preferences.

  a.. DLCTL_DLIMAGES, DLCTL_VIDEOS, and DLCTL_BGSOUNDS: Images, videos, and 
background sounds will be downloaded from the server and displayed or played 
if these flags are set. They will not be downloaded and displayed if the 
flags are not set.
  b.. DLCTL_NO_SCRIPTS and DLCTL_NO_JAVA: Scripts and Java applets will not 
be executed.
  c.. DLCTL_NO_DLACTIVEXCTLS and DLCTL_NO_RUNACTIVEXCTLS : ActiveX controls 
will not be downloaded or will not be executed.
  d.. DLCTL_DOWNLOADONLY: The page will only be downloaded, not displayed.
  e.. DLCTL_NO_FRAMEDOWNLOAD: The WebBrowser Control will download and parse 
a frameSet, but not the individual frame objects within the frameSet.
  f.. DLCTL_RESYNCHRONIZE and DLCTL_PRAGMA_NO_CACHE: These flags cause cache 
refreshes. With DLCTL_RESYNCHRONIZE, the server will be asked for update 
status. Cached files will be used if the server indicates that the cached 
information is up-to-date. With DLCTL_PRAGMA_NO_CACHE, files will be 
re-downloaded from the server regardless of the update status of the files.
  g.. DLCTL_NO_BEHAVIORS: Behaviors are not downloaded and are disabled in 
the document.
  h.. DLCTL_NO_METACHARSET_HTML: Character sets specified in meta elements 
are suppressed.
  i.. DLCTL_URL_ENCODING_DISABLE_UTF8 and DLCTL_URL_ENCODING_ENABLE_UTF8: 
These flags function similarly to the 
DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 and 
DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 flags used with 
IDocHostUIHandler::GetHostInfo. The difference is that the DOCHOSTUIFLAG 
flags are checked only when the WebBrowser Control is first instantiated. 
The download flags here for the ambient property change are checked whenever 
the WebBrowser Control needs to perform a download.
  j.. DLCTL_NO_CLIENTPULL: No client pull operations will be performed.
  k.. DLCTL_SILENT: No user interface will be displayed during downloads.
  l.. DLCTL_FORCEOFFLINE: The WebBrowser Control always operates in offline 
mode.
  m.. DLCTL_OFFLINEIFNOTCONNECTED and DLCTL_OFFLINE: These flags are the 
same. The WebBrowser Control will operate in offline mode if not connected 
to the Internet.
DISPID_AMBIENT_DLCONTROL and the flag values are defined in mshtmdid.h.

Initially, when the function call to IDispatch::Invoke starts, the VARIANT 
to which the parameter pvarResult points is of type VT_EMPTY. You must 
switch the type to VT_I4 for any settings to have an effect. You can place 
your flag values in the lVal member of the VARIANT.

Most of the flag values have negative effects, that is, they prevent 
behavior that normally happens. For instance, scripts are normally executed 
by the WebBrowser Control if you don't customize its behavior. But if you 
set the DLCTL_NOSCRIPTS flag, no scripts will execute in that instance of 
the control. However, three flags-DLCTL_DLIMAGES, DLCTL_VIDEOS, and 
DLCTL_BGSOUNDS-work exactly opposite. If you set flags at all, you must set 
these three for the WebBrowser Control to behave in its default manner 
vis-a-vis images, videos and sounds.

The following code sample causes a WebBrowser Control instance to download 
and display images and videos, but not background sounds, since the 
DLCTL_BGSOUNDS is not explicitly set. Also, script execution on pages 
displayed by the WebBrowser Control is disabled.

STDMETHODIMP CAtlBrCon::Invoke(DISPID dispidMember, REFIID riid,
                               LCID lcid, WORD wFlags,
                               DISPPARAMS* pDispParams,
                               VARIANT* pvarResult,
                               EXCEPINFO* pExcepInfo,
                               UINT* puArgErr)
{
    switch (dispidMember)
    {
    case DISPID_AMBIENT_DLCONTROL:
        pvarResult->vt = VT_I4;
        pvarResult->lVal = DLCTL_DLIMAGES | DLCTL_VIDEOS | DLCTL_NO_SCRIPTS;
        break;

    default:
        return DISP_E_MEMBERNOTFOUND;
    }

    return S_OK;
}
<END>Thanks so much for your help.  Contributors will be listed in the 
freeware browser being developed. 


4. Get IDispatch from DLL? - VB.Net

5. 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



6. How to get Outlook Inspector as IDispatch object from window handl

7. different between Iunknown and IDispatch In VB?

different between Iunknown and IDispatch In VB?

8. Passing IDispatch from VBScript to VI Server