Home > Software engineering >  Help: SHDocVwCtl WebBrowser types do not match, an error, please comment
Help: SHDocVwCtl WebBrowser types do not match, an error, please comment

Time:09-26

 Dim WithEvents WebBrowser1 As SHDocVwCtl. WebBrowser 
Dim dWinFolder As New ShellWindows
Dim objIE As Object
Private Declare Function ShellExecute Lib "shell32. DLL" Alias "ShellExecuteA" (ByVal HWND As Long, ByVal lpOperation As
String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd) As Long As Long
Private Declare Function ShowWindow Lib "user32" (ByVal HWND As Long, ByVal nCmdShow As Long) As Long
Dim objIehwnd As Long


Const JgDz="* * * * * * *" 'login address

Dim r As Long

Private Sub CommandButton1_Click login () '
The Set WebBrowser1=Nothing
R=ShellExecute (0, "open", Jgdz, 0, 0, 3)
For r=1 To 10000
For Each objIE dWinFolder In
If objIE. LocationURL=Jgdz Then

The Set WebBrowser1=objIE?????? Vb tip: error, type mismatch

WebBrowser1. Silent=True
ObjIehwnd=objIE. The HWND
CommandButton1. Enabled=False
The Exit Sub
End the If
Next
Next
End Sub


I wonder if there are other mistakes: no, please comment, thank you!!!

CodePudding user response:

To such as are ok?
Dim WithEvents WebBrowser1 As SHDocVwCtl. WebBrowser_V1

CodePudding user response:

Thank you very much!!!!!! To Dim WithEvents WebBrowser1 As SHDocVwCtl WebBrowser_V1, no error,
But there is no DocumentComplete WebBrowser1, please comment,

CodePudding user response:

CodePudding user response:

That's not there...

CodePudding user response:

Thank you for your guidance, no DocumentComplete,

CodePudding user response:

reference 5 floor syjjpxw reply:
thank you for your guidance, no DocumentComplete,

Your code, the two "class" of the object is different,
I carefully looked at the WebBrowser_V1 attributes of a class, between it and the WebBrowser object seems to be no "object swaps" properties or methods,
Don't know if you can use WebBrowser_V1 DownloadComplete events instead of processing?

CodePudding user response:

Thank Chen8013, convenient leave a contact number, QQ or phone, consult face to face, thank you!!!!!!

CodePudding user response:

Try another name stagger to, such as:
Dim WithEvents web1 As SHDocVwCtl. WebBrowser_V1

In addition, what are you doing this piece of code is automatically logged in? If so can directly manipulate objects objIE

CodePudding user response:

First of all to thank sysdzw guidance,
The source code of VBA:
Dim WithEvents WebBrowser1 As WebBrowser
Dim dWinFolder As New ShellWindows
Dim objIE As Object
Private Declare Function ShellExecute Lib "shell32. DLL" Alias "ShellExecuteA" (ByVal HWND As Long, ByVal lpOperation As
String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd) As Long As Long
Private Declare Function ShowWindow Lib "user32" (ByVal HWND As Long, ByVal nCmdShow As Long) As Long
Dim objIehwnd As Long


Const JgDz="* * * * * * *" 'login address

Dim r As Long

Private Sub Command1_Click login () '
The Set WebBrowser1=Nothing
R=ShellExecute (0, "open", Jgdz, 0, 0, 3)
For r=1 To 10000
For Each objIE dWinFolder In
If objIE. LocationURL=Jgdz Then
The Set WebBrowser1=objIE
WebBrowser1. Silent=True
ObjIehwnd=objIE. The HWND
Command1. Enabled=False
The Exit Sub
End the If
Next
Next
End Sub

Question:
Want to change in VB6.0 by use of IE6, tip:
1. The Dim WithEvents WebBrowser1 As WebBrowser
The Set WebBrowser1=objIE??????? Tip: mistakes in vb6, type mismatch


2. Dim WithEvents WebBrowser1 As WebBrowser_V1
Set WebBrowser1=objIE no error message, but no DocumentComplete


Use other event there are any errors, it is best to use the DocumentComplete, thank you!!!!!!

CodePudding user response:

Dim WithEvents web1 As SHDocVwCtl. WebBrowser_V1
The Set WebBrowser1=objIE no error, no DocumentComplete
Use other event there are any errors, it is best to use the DocumentComplete, thank you!!!!!!

CodePudding user response:

WebBrowser_V1 early version 3.0 of the past, so he support parameters is limited.
Don't support the
DocumentComplete

Don't understand your operation, you can try to use winsock or XMLHTTP realizes the Post and Get to implement landing operation.
  • Related