Results 1 to 7 of 7

Thread: Load Img To pct Box, + Check When A Server Version Was Gotten?

  1. #1

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    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

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    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 .

  3. #3
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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

  4. #4
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    VB Code:
    1. 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
    2.  
    3. Function LoadWebPicture(ByVal MyAddress As String) As StdPicture
    4. Dim RC As Long
    5.     RC = URLDownloadToFile(0, MyAddress, App.Path & "\temp.rc", 0, 0)
    6.     If RC <> 0 Then
    7.         Exit Function
    8.     Else
    9.         LoadWebPicture = LoadPicture(App.Path & "\temp.rc")
    10.     End If
    11. 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)

  5. #5
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Ah, I read the question 2 quick..

  6. #6

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    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
    Wayne

  7. #7

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    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"?
    Wayne

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width