vb中利用picturebox或imagebox显示网络图片,部分图片不能加载的问题
PrivateDeclareFunctionOleLoadPicturePathLib"oleaut32.dll"(ByValszURLorPathAsLong,ByVa...
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 = VB.LoadPicture(strFileName)
Err.Clear
End Function
Private Sub Command1_Click()
Picture1.Picture = LoadPicture("http://www.baidu.com/img/bdlogo.gif")
End Sub
之前网海书生大哥给的我这段代码,以前我在网上也搜索到过,但我现在遇到一个图片地址,无法加载,因为对上面的语句也是一知半解,所以想请教一下该如何修改此代码,如果有这个代码的详细讲解就更好了。
图片地址是
http://gi3.md.alicdn.com/bao/uploaded/i3/TB1DTtEGXXXXXa3XVXXXXXXXXXX_!!2-item_pic.png_430x430q90.jpg(不能加载)
http://gi1.md.alicdn.com/bao/uploaded/i1/TB1hWXQFVXXXXaQXXXXXXXXXXXX_!!0-item_pic.jpg_430x430q90.jpg(可以加载) 展开
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 = VB.LoadPicture(strFileName)
Err.Clear
End Function
Private Sub Command1_Click()
Picture1.Picture = LoadPicture("http://www.baidu.com/img/bdlogo.gif")
End Sub
之前网海书生大哥给的我这段代码,以前我在网上也搜索到过,但我现在遇到一个图片地址,无法加载,因为对上面的语句也是一知半解,所以想请教一下该如何修改此代码,如果有这个代码的详细讲解就更好了。
图片地址是
http://gi3.md.alicdn.com/bao/uploaded/i3/TB1DTtEGXXXXXa3XVXXXXXXXXXX_!!2-item_pic.png_430x430q90.jpg(不能加载)
http://gi1.md.alicdn.com/bao/uploaded/i1/TB1hWXQFVXXXXaQXXXXXXXXXXXX_!!0-item_pic.jpg_430x430q90.jpg(可以加载) 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询