|
-
Oct 26th, 2002, 01:02 PM
#1
Thread Starter
Frenzied Member
Load Img To pct Box, + Check When A Server Version Was Gotten?
Hey ya, This is probally a really easy Answer (and im sure i did this before in college, but like a yr ago etc)
But, i Download an image off the internet, and then after dat, i Write it to file, & Then After this, i want to enter it into a picture box,
How do i add it to the picture box, once i have the data in a variable,
IE: x = INet1.Open(URL)
?
Last edited by wpearsall; Oct 30th, 2002 at 10:21 PM.
Wayne
-
Oct 26th, 2002, 01:05 PM
#2
The picture isn't missing
i onlyknow of one way, and that's to save it first to disk then open it using loadpicture. maybe if anyone knows using dibs might be able to do it.
saving to file and opening:
x = INet1.Open(URL)
on error resume next
kill "C:\temp.bmp"
open "C:\temp.bmp" for binary as #1
put #1, , x
close #1
picture1.picture = loadpicture("C:\temp.bmp")
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Oct 26th, 2002, 01:22 PM
#3
PowerPoster
This is fully achievable with .NET. Follow this link to a sample class I wrote that stores the downloaded image in memory and diretly loads the image into a pic box (code is in C#).
http://www.vbforums.com/showthread.php?threadid=208640
-
Oct 26th, 2002, 01:39 PM
#4
Good Ol' Platypus
VB Code:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Function LoadWebPicture(ByVal MyAddress As String) As StdPicture
Dim RC As Long
RC = URLDownloadToFile(0, MyAddress, App.Path & "\temp.rc", 0, 0)
If RC <> 0 Then
Exit Function
Else
LoadWebPicture = LoadPicture(App.Path & "\temp.rc")
End If
End Sub
That should do it
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Oct 26th, 2002, 01:45 PM
#5
PowerPoster
Ah, I read the question 2 quick..
-
Oct 26th, 2002, 04:23 PM
#6
Thread Starter
Frenzied Member
Originally posted by BuggyProgrammer
i onlyknow of one way, and that's to save it first to disk then open it using loadpicture. maybe if anyone knows using dibs might be able to do it.
saving to file and opening:
x = INet1.Open(URL)
on error resume next
kill "C:\temp.bmp"
open "C:\temp.bmp" for binary as #1
put #1, , x
close #1
picture1.picture = loadpicture("C:\temp.bmp")
OK, i wanna keep the image for later use:
So, how do i split the filename off of the URL?
http://MyServer.com/MyDirectory/filename.gif
http://MyServer.com/MyDirectory/filename.jpg
http://MyServer.com/MyDirectory/filename.jpeg
ETC...
And If i do,
loadimage(Pathname)
Will it produce an error if the file doesnt exsist?, so i know i have to download the image, or?
Tnx
-
Oct 30th, 2002, 10:24 PM
#7
Thread Starter
Frenzied Member
OK, i have got this now,,, (At least i think), BUT,
How can i tell what Time the Server version was written (When uploaded via my App 2 the server), and what time the App version was written, So i can download a new version, as it is newly uploaded.
I Dont wanna have to have ppl downloading a same img of the thing, all the while, ETC..
Would this part be easy to "Accomplish"?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|