--
Blog de la Comunidad Visual FoxPro en Español http://comunidadvfp.blogspot.com
---
Has recibido este mensaje porque estás suscrito al grupo "Comunidad de Visual Foxpro en Español" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a publicesvfoxp...@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/publicesvfoxpro/546787f0-8c23-439d-961d-6a5bb28b412bn%40googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/publicesvfoxpro/3ab5844f-ae3a-454c-9d15-827e5c7e97abn%40googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/publicesvfoxpro/CA%2BEDH_UXpOg_7o0UGfd4enZz%2BczNY%2BNm%2Bq9s4sWrc_az2OyQvQ%40mail.gmail.com.
Este ejemplo viene en el link que te dejó Antonio
LOCAL Demo AS ViewRandomImage
m.Demo = CREATEOBJECT("ViewRandomImage")
m.Demo.Show()
READ EVENTS
DEFINE CLASS ViewRandomImage AS Form
ADD OBJECT editMe AS EditBox WITH Top = 4, Left = 4, Width = 300, Height = 200, ;
Value = "Edit me while images are being downloaded..."
ADD OBJECT clicker AS CommandButton WITH Top = 220, Left = 4, Caption = "Click me", Autosize = .T.
ADD OBJECT clickCounter AS Label WITH Top = 254, Left = 4, Caption = "Clicked 0 times", Autosize = .T.
ADD OBJECT Viewer AS Image WITH Top = 4, Left = 308, Width = 1000, Height = 500
ADD OBJECT Reloader AS Timer WITH Interval = 5000
Downloader = .NULL.
Clicks = 0
Width = 1350
Height = 520
PROCEDURE Init ()
This.Downloader = CREATEOBJECT("DownloadRandomImage", This)
WITH This.editMe AS Editbox
.SelStart = 0
.SelLength = LEN(.Value)
.SetFocus()
ENDWITH
ENDPROC
PROCEDURE Destroy ()
CLEAR EVENTS
ENDPROC
PROCEDURE clicker.Click ()
Thisform.Clicks = Thisform.Clicks + 1
Thisform.clickCounter.Caption = "Clicked " + LTRIM(STR(Thisform.Clicks)) + " time" + IIF(Thisform.Clicks != 1, "s", "")
PROCEDURE Reloader.Timer ()
IF ! ISNULL(Thisform.Downloader)
Thisform.Downloader.Download()
ENDIF
ENDPROC
PROCEDURE Callback (StatusCode AS Integer, ImageBlob AS Blob)
IF BETWEEN(m.StatusCode, 200, 299)
This.Viewer.PictureVal = m.ImageBlob
ENDIF
ENDPROC
ENDDEFINE
DEFINE CLASS DownloadRandomImage AS Custom
IMPLEMENTS IWinHttpRequestEvents IN "WinHttp.WinHttpRequest.5.1"
HTTPService = .NULL.
CallerForm = .NULL.
FUNCTION Init (Caller AS Form)
This.CallerForm = m.Caller
ENDFUNC
FUNCTION Destroy ()
This.CallerForm = .NULL.
This.HTTPService = .NULL.
ENDFUNC
FUNCTION Download ()
IF ! ISNULL(This.HTTPService)
TRY
This.HTTPService.Abort()
CATCH
ENDTRY
This.HTTPService = .NULL.
ENDIF
This.HTTPService = CREATEOBJECT("WinHttp.WinHttpRequest.5.1")
This.HTTPService.setTimeouts(0, 30000, 60000, 60000)
EVENTHANDLER(This.HTTPService, This)
This.HTTPService.Open("Get", "https://picsum.photos/1000/500", .T.)
This.HTTPService.Send()
ENDFUNC
PROCEDURE IWinHttpRequestEvents_OnError (ErrorNumber, ErrorDescription)
ENDPROC
PROCEDURE IWinHttpRequestEvents_OnResponseDataAvailable (Data)
ENDPROC
PROCEDURE IWinHttpRequestEvents_OnResponseFinished
TRY
This.CallerForm.CallBack(This.HTTPService.status, This.HTTPService.responseBody)
CATCH
ENDTRY
ENDPROC
PROCEDURE IWinHttpRequestEvents_OnResponseStart (Status, ContentType)
ENDPROC
ENDDEFINE --
Blog de la Comunidad Visual FoxPro en Español http://comunidadvfp.blogspot.com
---
Has recibido este mensaje porque estás suscrito al grupo "Comunidad de Visual Foxpro en Español" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a publicesvfoxp...@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/publicesvfoxpro/adc19c4a-94e4-4f98-b5df-85a5829f0eb9n%40googlegroups.com.