473,406 Members | 2,387 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,406 software developers and data experts.

Advanced webbrowser control help needed

I want to implement the same type of activeX restrictions in my browser
application that the new SP2 for XP places in Internet Explorer.

I have found 2 web pages dealing with this functionality
(http://msdn.microsoft.com/library/de...EATURELIST.asp
and
http://msdn.microsoft.com/library/de...tomization.asp)
but I am at a loss as to how to implement this functionality in VB.Net or
C#.

I tried adding urlmon.dll to my VB.Net project as a reference to use the
CoInternetSetFeatureEnabled functionality (see
http://msdn.microsoft.com/library/de...reenabled.asp),
but Visual Studio will not allow it. I get, in part, "This is not a valid
assembly or COM component." when I try and add it to my project.

Any help in implementing this type of functionality would be greatly
appreciated.

VB.Net is the language I am most familiar with, but C# examples would also
be helpful. I will re-write the app in C# if needed.

Jul 21 '05 #1
3 5517
Hi Jim

Try the following

<code>
Public Enum INTERNETFEATURELIST
FEATURE_OBJECT_CACHING = 0
FEATURE_ZONE_ELEVATION = 1
FEATURE_MIME_HANDLING = 2
FEATURE_MIME_SNIFFING = 3
FEATURE_WINDOW_RESTRICTIONS = 4
FEATURE_WEBOC_POPUPMANAGEMENT = 5
FEATURE_BEHAVIORS = 6
FEATURE_DISABLE_MK_PROTOCOL = 7
FEATURE_LOCALMACHINE_LOCKDOWN = 8
FEATURE_SECURITYBAND = 9
FEATURE_RESTRICT_ACTIVEXINSTALL = 10
FEATURE_VALIDATE_NAVIGATE_URL = 11
FEATURE_RESTRICT_FILEDOWNLOAD = 12
FEATURE_ADDON_MANAGEMENT = 13
FEATURE_PROTOCOL_LOCKDOWN = 14
FEATURE_HTTP_USERNAME_PASSWORD_DISABLE = 15
FEATURE_SAFE_BINDTOOBJECT = 16
FEATURE_UNC_SAVEDFILECHECK = 17
FEATURE_GET_URL_DOM_FILEPATH_UNENCODED = 18
FEATURE_ENTRY_COUNT = 19
End Enum

<DllImport("urlmon.DLL")> _
Public Shared Function CoInternetSetFeatureEnabled(ByVal featureEntry As
INTERNETFEATURELIST, ByVal dwFlags As Integer, ByVal fEnable As Boolean) As
Integer
End Function

<DllImport("urlmon.DLL")> _
Public Shared Function CoInternetIsFeatureEnabled(ByVal featureEntry As
INTERNETFEATURELIST, ByVal dwFlags As Integer) As Integer
End Function

Private Sub SetFeatureEnabled()

Dim lr As Integer = 0

Dim featureToEnable As INTERNETFEATURELIST =
INTERNETFEATURELIST.FEATURE_WEBOC_POPUPMANAGEMENT

If CoInternetSetFeatureEnabled(featureToEnable,
SET_FEATURE_ON_PROCESS, True) = 0 Then
' Check to make sure that the API worked as expected
If CoInternetIsFeatureEnabled(featureToEnable,
SET_FEATURE_ON_PROCESS) <> 0 Then
lr = 2
End If
Else
' The API returned an error while enabling pop-up management
lr = 1
End If

End Sub
</code>

Calling SetFeatureEnabled runs without error, although I haven't attempted
to check whether the browser then behaves as you expect. It does, however,
load the page that I subsequently navigate to.

HTH

Charles

"Jim Hubbard" <re***@groups.please> wrote in message
news:Eh******************@bignews3.bellsouth.net.. .
I want to implement the same type of activeX restrictions in my browser
application that the new SP2 for XP places in Internet Explorer.

I have found 2 web pages dealing with this functionality
(http://msdn.microsoft.com/library/de...EATURELIST.asp
and
http://msdn.microsoft.com/library/de...tomization.asp)
but I am at a loss as to how to implement this functionality in VB.Net or
C#.

I tried adding urlmon.dll to my VB.Net project as a reference to use the
CoInternetSetFeatureEnabled functionality (see
http://msdn.microsoft.com/library/de...reenabled.asp),
but Visual Studio will not allow it. I get, in part, "This is not a valid
assembly or COM component." when I try and add it to my project.

Any help in implementing this type of functionality would be greatly
appreciated.

VB.Net is the language I am most familiar with, but C# examples would also
be helpful. I will re-write the app in C# if needed.

Jul 21 '05 #2
Thanks for the help.

"Charles Law" <bl***@nowhere.com> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
Hi Jim

Try the following

<code>
Public Enum INTERNETFEATURELIST
FEATURE_OBJECT_CACHING = 0
FEATURE_ZONE_ELEVATION = 1
FEATURE_MIME_HANDLING = 2
FEATURE_MIME_SNIFFING = 3
FEATURE_WINDOW_RESTRICTIONS = 4
FEATURE_WEBOC_POPUPMANAGEMENT = 5
FEATURE_BEHAVIORS = 6
FEATURE_DISABLE_MK_PROTOCOL = 7
FEATURE_LOCALMACHINE_LOCKDOWN = 8
FEATURE_SECURITYBAND = 9
FEATURE_RESTRICT_ACTIVEXINSTALL = 10
FEATURE_VALIDATE_NAVIGATE_URL = 11
FEATURE_RESTRICT_FILEDOWNLOAD = 12
FEATURE_ADDON_MANAGEMENT = 13
FEATURE_PROTOCOL_LOCKDOWN = 14
FEATURE_HTTP_USERNAME_PASSWORD_DISABLE = 15
FEATURE_SAFE_BINDTOOBJECT = 16
FEATURE_UNC_SAVEDFILECHECK = 17
FEATURE_GET_URL_DOM_FILEPATH_UNENCODED = 18
FEATURE_ENTRY_COUNT = 19
End Enum

<DllImport("urlmon.DLL")> _
Public Shared Function CoInternetSetFeatureEnabled(ByVal featureEntry
As INTERNETFEATURELIST, ByVal dwFlags As Integer, ByVal fEnable As
Boolean) As Integer
End Function

<DllImport("urlmon.DLL")> _
Public Shared Function CoInternetIsFeatureEnabled(ByVal featureEntry As
INTERNETFEATURELIST, ByVal dwFlags As Integer) As Integer
End Function

Private Sub SetFeatureEnabled()

Dim lr As Integer = 0

Dim featureToEnable As INTERNETFEATURELIST =
INTERNETFEATURELIST.FEATURE_WEBOC_POPUPMANAGEMENT

If CoInternetSetFeatureEnabled(featureToEnable,
SET_FEATURE_ON_PROCESS, True) = 0 Then
' Check to make sure that the API worked as expected
If CoInternetIsFeatureEnabled(featureToEnable,
SET_FEATURE_ON_PROCESS) <> 0 Then
lr = 2
End If
Else
' The API returned an error while enabling pop-up management
lr = 1
End If

End Sub
</code>

Calling SetFeatureEnabled runs without error, although I haven't attempted
to check whether the browser then behaves as you expect. It does, however,
load the page that I subsequently navigate to.

HTH

Charles

"Jim Hubbard" <re***@groups.please> wrote in message
news:Eh******************@bignews3.bellsouth.net.. .
I want to implement the same type of activeX restrictions in my browser
application that the new SP2 for XP places in Internet Explorer.

I have found 2 web pages dealing with this functionality
(http://msdn.microsoft.com/library/de...EATURELIST.asp
and
http://msdn.microsoft.com/library/de...tomization.asp)
but I am at a loss as to how to implement this functionality in VB.Net or
C#.

I tried adding urlmon.dll to my VB.Net project as a reference to use the
CoInternetSetFeatureEnabled functionality (see
http://msdn.microsoft.com/library/de...reenabled.asp),
but Visual Studio will not allow it. I get, in part, "This is not a
valid
assembly or COM component." when I try and add it to my project.

Any help in implementing this type of functionality would be greatly
appreciated.

VB.Net is the language I am most familiar with, but C# examples would
also
be helpful. I will re-write the app in C# if needed.


Jul 21 '05 #3
Found that the Microsoft security model interferes with handling security
myself without allowing the granular control that I need for each URL.

I found a way that should work and am coding my own control (that uses the
webbrowser control also) to allow total control over the objects displayed
in the webbrowser control (whether they are vbscripts, java applets, activeX
controls, images or whatever).

Thanks again for the help.

"Jim Hubbard" <re***@groups.please> wrote in message
news:BK********************@bignews1.bellsouth.net ...
Thanks for the help.

"Charles Law" <bl***@nowhere.com> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
Hi Jim

Try the following

<code>
Public Enum INTERNETFEATURELIST
FEATURE_OBJECT_CACHING = 0
FEATURE_ZONE_ELEVATION = 1
FEATURE_MIME_HANDLING = 2
FEATURE_MIME_SNIFFING = 3
FEATURE_WINDOW_RESTRICTIONS = 4
FEATURE_WEBOC_POPUPMANAGEMENT = 5
FEATURE_BEHAVIORS = 6
FEATURE_DISABLE_MK_PROTOCOL = 7
FEATURE_LOCALMACHINE_LOCKDOWN = 8
FEATURE_SECURITYBAND = 9
FEATURE_RESTRICT_ACTIVEXINSTALL = 10
FEATURE_VALIDATE_NAVIGATE_URL = 11
FEATURE_RESTRICT_FILEDOWNLOAD = 12
FEATURE_ADDON_MANAGEMENT = 13
FEATURE_PROTOCOL_LOCKDOWN = 14
FEATURE_HTTP_USERNAME_PASSWORD_DISABLE = 15
FEATURE_SAFE_BINDTOOBJECT = 16
FEATURE_UNC_SAVEDFILECHECK = 17
FEATURE_GET_URL_DOM_FILEPATH_UNENCODED = 18
FEATURE_ENTRY_COUNT = 19
End Enum

<DllImport("urlmon.DLL")> _
Public Shared Function CoInternetSetFeatureEnabled(ByVal featureEntry
As INTERNETFEATURELIST, ByVal dwFlags As Integer, ByVal fEnable As
Boolean) As Integer
End Function

<DllImport("urlmon.DLL")> _
Public Shared Function CoInternetIsFeatureEnabled(ByVal featureEntry
As INTERNETFEATURELIST, ByVal dwFlags As Integer) As Integer
End Function

Private Sub SetFeatureEnabled()

Dim lr As Integer = 0

Dim featureToEnable As INTERNETFEATURELIST =
INTERNETFEATURELIST.FEATURE_WEBOC_POPUPMANAGEMENT

If CoInternetSetFeatureEnabled(featureToEnable,
SET_FEATURE_ON_PROCESS, True) = 0 Then
' Check to make sure that the API worked as expected
If CoInternetIsFeatureEnabled(featureToEnable,
SET_FEATURE_ON_PROCESS) <> 0 Then
lr = 2
End If
Else
' The API returned an error while enabling pop-up management
lr = 1
End If

End Sub
</code>

Calling SetFeatureEnabled runs without error, although I haven't
attempted to check whether the browser then behaves as you expect. It
does, however, load the page that I subsequently navigate to.

HTH

Charles

"Jim Hubbard" <re***@groups.please> wrote in message
news:Eh******************@bignews3.bellsouth.net.. .
I want to implement the same type of activeX restrictions in my browser
application that the new SP2 for XP places in Internet Explorer.

I have found 2 web pages dealing with this functionality
(http://msdn.microsoft.com/library/de...EATURELIST.asp
and
http://msdn.microsoft.com/library/de...tomization.asp)
but I am at a loss as to how to implement this functionality in VB.Net
or
C#.

I tried adding urlmon.dll to my VB.Net project as a reference to use
the
CoInternetSetFeatureEnabled functionality (see
http://msdn.microsoft.com/library/de...reenabled.asp),
but Visual Studio will not allow it. I get, in part, "This is not a
valid
assembly or COM component." when I try and add it to my project.

Any help in implementing this type of functionality would be greatly
appreciated.

VB.Net is the language I am most familiar with, but C# examples would
also
be helpful. I will re-write the app in C# if needed.



Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim Hubbard | last post by:
I want to implement the same type of activeX restrictions in my browser application that the new SP2 for XP places in Internet Explorer. I have found 2 web pages dealing with this functionality...
3
by: Jim Hubbard | last post by:
I want to implement the same type of activeX restrictions in my browser application that the new SP2 for XP places in Internet Explorer. I have found 2 web pages dealing with this functionality...
2
by: frederik12 | last post by:
Hi all, Today I downloaded and installed VS 2005 C# Express Edition (.NET framework 2.0). I'm very pleased about this new product. In my current application I'm using the WebBrowser control in...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
11
by: Anil Gupte | last post by:
....and how do I insert one into my form? I used in VB 6.0 last, but cannot figure out where it is in .Net Thanx, -- Anil Gupte www.keeninc.net www.icinema.com
0
by: =?Utf-8?B?c25naWxi?= | last post by:
I am having 3 issues with the WebBrowser control which may all be related. The HTML for the page is the standard Weather Magnet from weather.com. The actual HTML is at the bottom of this page. ...
2
by: Scott Gravenhorst | last post by:
I recently (within 30 days) downloaded and installed VB 2005 Express. I like it a whole lot... but: I have been trying to work with the WebBrowser control to display a small amount of help text...
6
by: Leon | last post by:
Hi there, I am trying to use the WebBrowser Control in a form which is being started in an own thread by the main form of my application. Unfortunately I am always getting an error in...
0
by: scottietrek | last post by:
I have a webbrowser control that allows me to save username and password infromation for a proxy server and i have been successful in changing the system default proxy for my application. What i now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.