WebBrowser Control - Not add to global history

I created small form with simple WebBrowser control. This may navigate to my secret website at startup. I modified WebBrowser by WBCustomizer to disable context menus. I wanted to disable adding viewed pages to history. I searched forums and internet and I discovered that WebBrowser adds page tobrowser session history and that can be controlled by navNoHistory flag but WebBrowser adds page toglobal history in any case. So I thinked up a solution. I will make a subprocedure (NavigateComplete2 event) that can delete navigated page from history by URL. Can you tell me what library function(s) I must use?
[644 byte] By [PetrManek] at [2007-12-28]
# 1

Petr Manek,

I noticed that you modified your question post four times. It seems that you are serious on this problem. I don't know whether you're familiar with the vbscript or javascript because it is possible that you close the browser's cookie and the server's session by the script code in your project.

Have you tried to search some functions in code project or msdn? If there is not proper functions or methods to realize your WebBrowser functions, I suggest you to try some scripts.

Hope that you can find a best solution.

BrunoYu-MSFT at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2

I searched codeproject.com and I have found this: The tiny wrapper class for URL history interface in C# - The Code Project - C# Programming. But I don't know how can I implement it to my code...

Here's my source code of my WebBrowser control form:


Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetComputerName Lib "kernel32.dll" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function DeleteRegistryKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Dim Customizer As WBCustomizer
Const navNoHistory = 2

Private Sub Form_Load()
On Error Resume Next
Form_Resize

Dim sBuffer As String
Dim sBuffer2 As String
Dim lSize As Long
Dim lSize2 As Long

sBuffer = Space$(255)
lSize = Len(sBuffer)
sBuffer2 = Space$(255)
lSize2 = Len(sBuffer2)

Call GetUserName(sBuffer, lSize)
Call GetComputerName(sBuffer2, lSize2)

Set Customizer = New WBCustomizer
With Customizer
.EnableContextMenus = False
.EnableAllAccelerators = True
Set .WebBrowser = brwWebBrowser
End With

brwWebBrowser.Navigate2 "http://MySecretWebsite.com/WorkStationAttempt.aspx?Computer=" & Left$(sBuffer2, lSize2) & "&LoggedUser=" & Left$(sBuffer, lSize), navNoHistory
brwWebBrowser.SetFocus
End Sub

Private Sub Form_Resize()
On Error Resume Next
brwWebBrowser.Width = Me.ScaleWidth
brwWebBrowser.Height = Me.ScaleHeight
End Sub

PetrManek at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 3

Petr Manek,

Did you try to add a reference for your .NET project? Or add the dll in the Toolbox to make it like a control.

BrunoYu-MSFT at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 4
I have tried to add dll in the Toolbox to make it like control but I don't know what dll I must use
PetrManek at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 5

Petr Manek,

The DLL file I suggested you to add as a reference is compiled by VB6 and when you would like to use it, you should firstly register in your .NET Framework. As a control that can be used, the file is actually a ocx file, use the "regsvr32 FileName.ocx" can help you to register on other computer to use.

I suggest you to have a look at the related information on COM Interop and P/Invoke knowledge, then you can totally understand the COM and help you to know better on .NET Framework.

BrunoYu-MSFT at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic General...