2012.01.05 15:58

Image나 PictureBox에 URL로 이미지 로딩하기

' 아래의 함수를 사용하면 가능

' image1.picture = loadwebpicture("url") 
' 별도의 모듈에 선언해 넣을것
' 출처는 
http://www.devpia.com/Maeul/Contents/Detail.aspx?BoardID=48&MAEULNO=19&no=3692&page=2 
' 여기 데브피아에 회원정보를 까먹어서 감사하다는 인사를 못드림..ㅠㅠ OTL

Private Type TGUID
    Data1 As Long
    Data2 As Integer
    Data3 As Integer
    Data4(0 To 7) As Byte
End Type
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

Public Function LoadWebPicture(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 ERR_LINE
    OleLoadPicturePath StrPtr(strFileName), 0&, 0&, 0&, IID, LoadWebPicture
    Exit Function
ERR_LINE:
    Set LoadWebPicture = VB.LoadPicture(strFileName)
End Function

신고
Trackback 0 Comment 0


티스토리 툴바