阿凱 發問時間: 電腦與網際網路程式設計 · 1 0 年前

VB6-如何將網頁上的圖片存放到PictureBox裡

網址是指一個僅圖片的網址

而且圖案副檔名也固定為jpg

例如:http://l.yimg.com/tw.yimg.com/i/tw/hp/today/081225...

請問各位大大

如何將指定網頁裡的那張圖放到PictureBox裡??

2 個解答

評分
  • W.J.S.
    Lv 7
    1 0 年前
    最佳解答

    '(1)用Inet物件(引用Microsoft Internet Transfer Control 6.0) 請參考:http://tw.knowledge.yahoo.com/question/question?qi...

    '(2)利用OleLoadPicturePath API

    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

    Private Sub Command1_Click()

    Dim IID As TGUID, s As String, p As Picture

    s = "http://l.yimg.com/tw.yimg.com/i/tw/hp/today/081225...

    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 ER

    OleLoadPicturePath StrPtr(s), 0&, 0&, 0&, IID, p

    Picture1.Picture = p

    Set p = Nothing

    Exit Sub

    ER:

    MsgBox Error

    End Sub

    2008-12-26 17:34:39 補充:

    經豬大提醒找了一下,當時此問題竟遭棄置淪入票選,想當時在股溝也找好久的說.

    參考資料: API-Guide
  • 1 0 年前

    請參考 W.J.S. 大師 大作

還有問題?馬上發問,尋求解答。