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 Long Private Const CP_UTF8 = 65001
Private Declare Function MultiByteToWideChar Lib "kernel32" ( _
ByVal CodePage As Long, ByVal dwFlags As Long, _
ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, _
ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long '取网页源码
Public Function webTxtGet(ByVal Url1 As String) As String
Dim strFile As String
Dim lngReturn As Long
Dim TextLine As String, textCon As String
Dim Big5str As String
Dim tmpUTF8() As Byte
Dim lLength As Long, lBytes As Long, lWC As Long
On Error Resume Next
strFile = App.Path & "\txtWeb.txt"
Open strFile For Output As #1
Close #1
lngReturn = URLDownloadToFile(0, Url1, strFile, 0, 0)
Open strFile For Binary As #1
webTxtGet = Space(LOF(1))
Get #1, , webTxtGet
Close #1
Kill strFile
End Function '取网页源码_如果网页是UTF-8
Public Function webTxtGet_utf8(ByVal Url1 As String) As String
Dim strFile As String
Dim lngReturn As Long
Dim TextLine As String, textCon As String
Dim Big5str As String
Dim tmpUTF8() As Byte
Dim lLength As Long, lBytes As Long, lWC As Long
On Error Resume Next
strFile = App.Path & "\
相关文档:
教你如何用VB做控件*.ocx
一个控件有很多事件如:Click、MouseDown、MouseUp、MouseMove等。要触发这些事件都需要你加入代码。在控件的声明处加入Public Event Click()就表明该控件有一“Click”事件。自己编写的控件有什么事件就在声明处加几条事件
如今OCX控件在编程中已占领了很重要的地位,我们可以利用OC ......
Visual Basic有着强大的数据库存取能力,不仅能够直接支持Ms Access数据库,而且通过其内部安装的ISAM驱动程序使它能间接支持FoxPro、dBASE等外来数据库。本文不仅从VB数据库体系结构的角度探索了VB对这些外来数据库的支持,还结合了一些实例具体阐述了使用数据库存取对象变量的方法实现这些外来数据库的新建、库结构修改、 ......
把鼠标移到屏幕指定位置 如(111.111) 单击一下
再移到屏幕另一指定位置指定位置 如(222.222)单击一下
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Function SetCursorPo ......
Public Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" (Var() As Any) As Long
Public Declare Function VarPtrStringArray Lib "msvbvm60.dll" Alias "VarPtr" (Var() As Any) As Long
取对象地址: ObjPtr
取OLE对象的地址: OLE_NAME.LpOleObject
取函数地址: AddressOf
取字符串地址: StrPtr
取 ......