473,394 Members | 1,752 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,394 software developers and data experts.

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.
Nov 21 '05 #1
0 1150

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: multi_term2000 | last post by:
I wanna customize web browser. Can someone show me an example? Thanks
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 =...
1
by: Dmitry Medvedev | last post by:
Hello, I need to write C# class, that would implement IDispatch interface to be used in ActiveScript. I can't use IReflect interface here due to design issues, I need to handle GetIDsOfNames...
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;...
8
by: Charles Law | last post by:
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>...
0
by: Jim Hubbard | last post by:
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,...
5
by: Nikolay Belyh | last post by:
I have created a "collection" in C# like this: namespace ClassLibrary1 { public class X {} public class Class1 { public ArrayList objs {
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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:
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...

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.