i need some help with image refresh..
1.i load a picture from a url
-the picture from url is changed every 5 second by the website admin
i need that my program to refresh the loaded image every 5 sec.
this is the code but i think the image is loaded in "temp" and the refresh not work...or i have made wrong something..?
(add a picture box and two timers to bellow code'
Code: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 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 OleLoadPicturePath StrPtr(strFileName), 0&, 0&, 0&, IID, LoadPicture End Function '----------------------------------------------------' Private Sub Form_Load() Timer1.Interval = 2000 Timer2.Interval = 4000 End Sub '------------------------------------------------------' Public Function LoadPicture2(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 OleLoadPicturePath StrPtr(strFileName), 0&, 0&, 0&, IID, LoadPicture2 End Function '----------------------------------------------------------' 'I try to refresh with timers, no result :( ' Private Sub Timer1_Timer() Picture1.Picture = LoadPicture("http://CHANGEDIMAGE-ON-5SEC/mini.jpg") End Sub '--------------------------------------------------------------' Private Sub Timer2_Timer() Picture1.Picture = Nothing End Sub


Reply With Quote




Bookmarks