problems with Document2Events on W2K and XP

G

Guest

Hi

The following (shrinkwrapped) code works ok on Windows 2003 but not on Windows 2000 SP4 and XP where ALL events are blocked (e.g. context menu does not appear, impossible to write in search TextBox etc.)

Framework: v1.1.4322

Dependencies on W2000:
mscoree.dll 1.1.4322.573
advapi32.dll 5.0.2195.6710
urlmon.dll 6.0.2800.1400
shlwapi.dll 6.0.2800.1400

Which one is the culprit?
What can I do during deployment to ensure that my program works on windows 2000 and XP?

Code:

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents AxWebBrowser1 As AxSHDocVw.AxWebBrowser
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.AxWebBrowser1 = New AxSHDocVw.AxWebBrowser
CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'AxWebBrowser1
'
Me.AxWebBrowser1.Dock = System.Windows.Forms.DockStyle.Fill
Me.AxWebBrowser1.Enabled = True
Me.AxWebBrowser1.Location = New System.Drawing.Point(0, 0)
Me.AxWebBrowser1.OcxState = CType(resources.GetObject("AxWebBrowser1.OcxState"), System.Windows.Forms.AxHost.State)
Me.AxWebBrowser1.Size = New System.Drawing.Size(292, 273)
Me.AxWebBrowser1.TabIndex = 0
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.AxWebBrowser1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AxWebBrowser1.Navigate("http://www.microsoft.com";)
End Sub

Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles AxWebBrowser1.DocumentComplete
Dim Document2 As mshtml.IHTMLDocument2 = CType(AxWebBrowser1.Document, mshtml.IHTMLDocument2)
Dim Document2Events As mshtml.HTMLDocumentEvents2_Event = CType(Document2, mshtml.HTMLDocumentEvents2_Event)

Try
RemoveHandler Document2Events.onclick, AddressOf event2b
Catch 'ex As Exception : Debug.WriteLine(ex.Message)
End Try
Try
AddHandler Document2Events.onclick, AddressOf event2b
Catch ex As Exception : Debug.WriteLine(ex.Message)
End Try

End Sub

Private Function event2b(ByVal e As mshtml.IHTMLEventObj) As Boolean
e.returnValue = True
Return True
End Function

End Class
 
R

Richard T. Edwards

Your advapi32.dll 5.0.2195.6710 is older than the one I have on my Pro XP.

IE's two are the same: urlmon and shlwapi

So, as long as you're installing the 1.1, your program should work fine

You may want to look at:

MDAC. Running 2.80 on 2003?




Hi

The following (shrinkwrapped) code works ok on Windows 2003 but not on
Windows 2000 SP4 and XP where ALL events are blocked (e.g. context menu does
not appear, impossible to write in search TextBox etc.)
Framework: v1.1.4322

Dependencies on W2000:
mscoree.dll 1.1.4322.573
advapi32.dll 5.0.2195.6710
urlmon.dll 6.0.2800.1400
shlwapi.dll 6.0.2800.1400

Which one is the culprit?
What can I do during deployment to ensure that my program works on windows 2000 and XP?

Code:

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents AxWebBrowser1 As AxSHDocVw.AxWebBrowser
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.AxWebBrowser1 = New AxSHDocVw.AxWebBrowser
CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'AxWebBrowser1
'
Me.AxWebBrowser1.Dock = System.Windows.Forms.DockStyle.Fill
Me.AxWebBrowser1.Enabled = True
Me.AxWebBrowser1.Location = New System.Drawing.Point(0, 0)
Me.AxWebBrowser1.OcxState = CType(resources.GetObject("AxWebBrowser1.OcxState"),
System.Windows.Forms.AxHost.State)
Me.AxWebBrowser1.Size = New System.Drawing.Size(292, 273)
Me.AxWebBrowser1.TabIndex = 0
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.AxWebBrowser1)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
AxWebBrowser1.Navigate("http://www.microsoft.com";)
End Sub

Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object,
ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles
AxWebBrowser1.DocumentComplete
Dim Document2 As mshtml.IHTMLDocument2 =
CType(AxWebBrowser1.Document, mshtml.IHTMLDocument2)
Dim Document2Events As mshtml.HTMLDocumentEvents2_Event =
CType(Document2, mshtml.HTMLDocumentEvents2_Event)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top