|
从网上找了个代码,无缓存加载网络图片,速度有时候极慢,极大影响程序运行,经常造成程序假死。现在请假各位老师,有没有高效一点加载网络图片的例子。
目前用的方法是以下这种无缓存加载的
Private Declare Function OleLoadPicturePath Lib "oleaut32.dll" (ByVal szURLorPath As Long, ByVal punkCaller As Long, ByVal dwReserved As Long, ByVal clrReserved As OLE_COLOR, ByRef riid As TGUID, ByRef ppvRet As IPicture) As Long
Private Type TGUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
'加载函数
Public Function LoadPicture(ByVal strFileName As String) As Picture
Dim IID As TGUID
With IID
.Data1 = &H7BF80980
.Data2 = &HBF32
.Data3 = &H101A
.Data4(0) = &H8B
.Data4(1) = &HBB
.Data4(2) = &H0
.Data4(3) = &HAA
.Data4(4) = &H0
.Data4(5) = &H30
.Data4(6) = &HC
.Data4(7) = &HAB
End With
On Error GoTo LocalErr
OleLoadPicturePath StrPtr(strFileName), 0&, 0&, 0&, IID, LoadPicture
Exit Function
LocalErr:
Set LoadPicture = LoadPicture(strFileName)
Err.Clear
End Function
使用方法:
Set 控件名.Pictue = LoadPicture(图片网络路径)
image控件加载网络图片.rar
(14.67 KB, 下载次数: 5)
|
|