VB中open命令怎么打开网络的内容啊

来源:百度知道 编辑:UC知道 时间:2024/07/03 14:57:52
我写了这么段VB
-----------------------------------------------------
Dim a
Open "d:\123.txt" For Input As #1
Line Input #1, aspect
a = aspect
If a = 211 Then
MsgBox "正确"
Else
MsgBox "错误"
End
End If
------------------------------------------------
那个open只能打开计算机的内容,现在我要打开的是
http://sijie.qqnn.net的内容,该怎么改呢

第一种,调用API的ShellExecute函数:
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
Const SW_SHOW = 5
上面是声明部分
Private Sub Form_Load()
ShellExecute Me.hwnd, "open", "http://sijie.qqnn.net", "", "", SW_SHOW
End Sub
第二种,用VB中的shell函数:
Shell "explorer.exe http://sijie.qqnn.net",vbNormalFocus

你可以先用inet控件下载网页内容,然后直接进行判断即可。

代码如下:
Dim b() As Byte, fn As Long, a As String
Inet1.Cancel
Inet1.Protocol = icHTTP
Inet1.url = "http://si