form1::::::::::::::::
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST& = -1
Private Const SWP_NOSIZE& = &H1
Private Const SWP_NOMOVE& = &H2
Private Sub Command1_Click()
Call chaxun
End Sub
Private Sub Command2_Click()
Dim s As String
If Text1.Text = "" Then
MsgBox "怎么什么也不写,那怎么搜索啊", vbOKCancel, "警告"
Text1.Text = "输入要搜索的关键字"
End If
s = Form1.Text1.Text
Form2.WebBrowser1.Navigate "http://www.baidu.com/s?wd=" + s
Form2.Show
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
Unload Form1
Unload Form2
Form3.Show
End Sub
Private Sub Form_Load()
Label1.ForeColor = vbBlue
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub
Private Sub Text1_GotFocus()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call chaxun
End If
End Sub
Private Sub Timer1_Timer()
If Label1.ForeColor = vbBlue Then
Label1.ForeColor = vbGreen
Else
Label1.ForeColor = vbBlue
End If
End Sub
Private Sub chaxun()
Dim a As String, b As String, c As Integer, d As Integer, i As Integer
If Text1.Text = "" Then
MsgBox "怎么什么也不写,那怎么搜索啊", vbOKCancel, "警告"
Text1.Text = "输入要搜索的关键字"
End If
a = Text1.Text
c = Len(a)
Open "answer.dat" For Input As #1
Do While Not EOF(1)
Line Input #1, b
d = Len(b)
For i = 1 To (d - c + 1)
If Mid(b, i, c) = a Then
Text2.Text = Text2.Text + b & vbCrLf
End If
Next i
Loop
Close #1
End Sub
Open "answer.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, b
d = Len(b)
For i = 1 To (d - c + 1)
If Mid(b, i, c) = a Then
Text2.Text = Text2.Text + b & vbCrLf
End If
Next i
Loop
Close #1
End Sub
form3:::::::::::::::::::
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 Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Sub Command1_Click()
End
End Sub
Private Sub Label3_Click()
Call ShellExecute(Me.hwnd, "open", "http://l.thec.cn/dtzx/dtdtq.rar", vbNullString, vbNullString, SW_SHOWNORMAL)
End Sub