|
-
May 26th, 2002, 02:45 PM
#1
Thread Starter
Hyperactive Member
.picture = Loadpicture("online")
Hello,
I'm making an app that uses online graphics. I first used the webbowser control to load the images, but than I had an Idea. I would try picture1.picture = loadpicture(OnlineImageURL). This only worked when I put it directly in the proprties of the Picture1. When I try to run this code, it gives an error File / Path Access error... 
Can anybody help me out?
"Experience is something you don't get until just after you need it."
-
May 26th, 2002, 03:55 PM
#2
Good Ol' Platypus
Here, put this in its own module:
VB Code:
Option Explicit
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
Public TempPath As String
Public Function LoadPictureInet(URL As String) As StdPicture
Dim rval As Long
If TempPath = "" Then TempPath = App.Path
rVal = URLDownloadToFile(0, URL, TempPath & "\temp.dat", 0, 0)
Set LoadPictureInet = LoadPicture(TempPath & "\temp.dat")
Kill TempPath & "\temp.dat"
End Function
Usage:
VB Code:
TempPath = "C:\Temp"
Set Picture1.Picture = LoadPictureInet("http://www.crystal-rain.com/art/lizardman.jpg")
Last edited by Sastraxi; May 26th, 2002 at 06:18 PM.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 26th, 2002, 04:08 PM
#3
Thread Starter
Hyperactive Member
Thank you very much.. I though It would be possible to load it directly from the web, but it seems not... Well, I'll use your method. Thank you very much...
"Experience is something you don't get until just after you need it."
-
May 26th, 2002, 06:16 PM
#4
Good Ol' Platypus
In any way it'll [most likely] be saved temporarily in Windows/Temp first, so this way is just as good. Plus, it ensures the file is deleted after its displayed.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 26th, 2002, 06:18 PM
#5
Good Ol' Platypus
The code's fixed now. Before, it would give an invalid use of property error.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|