Unless you are in control of the pages the client can view, that is going to
be difficult because you won't know what the name of the search box is.
You might just want to log wherever they navigate to, and use that to help
determine which pages use what names for their parameters.
Here is s short example of how you can monitor IE. It uses a form that
reports the data as it happens, but you don't need to use a form, a class
would do, or, you don't need to show the form, you could just log the
data behind the scenes.
To see the example, start a new project and add a reference to
Microsoft Internet Controls. Then give the form a Textbox and set its
MultiLine property to True, and ScrollBars property to 3 (Both).
Paste in the code below and run the program. When IE shows up
use it to navigate around, (Do a few searches) and watch the output in
the form. It is a bit interesting to navigate to My Computer, or the
Recycle bin, or other such system places...
(Keep in mind this is only one way to grab a reference to a running instance.
There are others....)
HTH
LFS
Option Explicit
' Add reference to Microsoft Internet Controls for:
Private WithEvents IE As InternetExplorer
Private Sub Form_Load()
Dim newEx As New InternetExplorer
Text1.Text = ""
newEx.Visible = True
newEx.Navigate2 "about:blank"
Set IE = newEx
End Sub
Private Sub Form_Resize()
Text1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
IE.Quit
Set IE = Nothing
End Sub
Private Sub IE_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As
Variant, Headers As Variant, Cancel As Boolean)
Post "Navigate:", URL, "Flags:", Flags, "Name:", TargetFrameName, "Data:", StrConv(PostData, vbUnicode), "Header:", Headers
End Sub
Private Sub IE_OnQuit()
Unload Me
End Sub
Private Sub Post(ParamArray Data())
Dim i
If Len(Text1.Text) > 28000 Then
i = InStr(2000, Text1.Text, vbCrLf & vbCrLf & vbCrLf)
Text1.Text = Mid$(Text1.Text, i + 8)
Text1.SelStart = Len(Text1.Text)
End If
For i = 0 To UBound(Data) Step 2
Text1.SelText = Data(i) & vbCrLf
Text1.SelText = Data(i + 1)
Text1.SelText = vbCrLf & vbCrLf
Next
Text1.SelText = vbCrLf & vbCrLf
End Sub
be difficult because you won't know what the name of the search box is.
You might just want to log wherever they navigate to, and use that to help
determine which pages use what names for their parameters.
Here is s short example of how you can monitor IE. It uses a form that
reports the data as it happens, but you don't need to use a form, a class
would do, or, you don't need to show the form, you could just log the
data behind the scenes.
To see the example, start a new project and add a reference to
Microsoft Internet Controls. Then give the form a Textbox and set its
MultiLine property to True, and ScrollBars property to 3 (Both).
Paste in the code below and run the program. When IE shows up
use it to navigate around, (Do a few searches) and watch the output in
the form. It is a bit interesting to navigate to My Computer, or the
Recycle bin, or other such system places...
(Keep in mind this is only one way to grab a reference to a running instance.
There are others....)
HTH
LFS
Option Explicit
' Add reference to Microsoft Internet Controls for:
Private WithEvents IE As InternetExplorer
Private Sub Form_Load()
Dim newEx As New InternetExplorer
Text1.Text = ""
newEx.Visible = True
newEx.Navigate2 "about:blank"
Set IE = newEx
End Sub
Private Sub Form_Resize()
Text1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
IE.Quit
Set IE = Nothing
End Sub
Private Sub IE_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As
Variant, Headers As Variant, Cancel As Boolean)
Post "Navigate:", URL, "Flags:", Flags, "Name:", TargetFrameName, "Data:", StrConv(PostData, vbUnicode), "Header:", Headers
End Sub
Private Sub IE_OnQuit()
Unload Me
End Sub
Private Sub Post(ParamArray Data())
Dim i
If Len(Text1.Text) > 28000 Then
i = InStr(2000, Text1.Text, vbCrLf & vbCrLf & vbCrLf)
Text1.Text = Mid$(Text1.Text, i + 8)
Text1.SelStart = Len(Text1.Text)
End If
For i = 0 To UBound(Data) Step 2
Text1.SelText = Data(i) & vbCrLf
Text1.SelText = Data(i + 1)
Text1.SelText = vbCrLf & vbCrLf
Next
Text1.SelText = vbCrLf & vbCrLf
End Sub