Notice that when you open that, it brings it up as an image. But I have code to put images directly from the internet onto my Image1. The thing is, it wont work for that since it doesn't have a .png or .jpg or .gif or any of those extentions.
any idea how i would put that image on my program without actually downloading it to my harddrive?
I don't think the Image or the Picturebox supports .PNG
EDIT
I was able to get it onto my hard drive and I can display it by double clicking on it but I cant load it into my Picturebox control. It is downloaded as a .png. Now I know .png files are not supported
Last edited by jmsrickland; Apr 17th, 2008 at 05:39 PM.
I don't have vb6 in front of me so could you please confirm whether the image control supports the .png extns. I know it does support .jpg and .gif
What does
Image1.Picture = "http://ichart.finance.yahoo.com/b?s=DIS" give you assuming that it supports png?
as the link which you have given is a .png file and the name of the file is "b.png"
Im aware its a png file. And an image control can take any image file extensions if i understood you right on that part.
but anyways
Im wondering, just incase someone doesn't know the code to get the image to the image control without downloading, if its possible someone could also supply me with the code to download that image to the harddrive and then put it from the harddrive to the image control.
And an image control can take any image file extensions if i understood you right on that part.
What I meant was that since i cannot check it can you confirm by checking the control in design mode by clicking the picture property of image1 to check if png is supported in the box that opens?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
oh, alright. well, you are able to save it as a jpg on the computer and it still works anyways under that extention. Any idea how i would download the image to my harddrive then?
oh, alright. well, you are able to save it as a jpg on the computer and it still works anyways under that extention. Any idea how i would download the image to my harddrive then?
Just right click on the image and save it to your hard drive as a .bmp file then rename it to a .png file
Even so, .png files are not supported.
Im asking to download it with my program, not manually download it or use another program to download it and convert it with. Also, this does NOT need to be converted. All that needs to be done to it to be put on a Image Control is to change the extension from .png to .jpg.
This is some thing I D/L'd from some webpage but can not remember where, maybe PSC. Use the API below to download the png and then use the ZIP module to put it in a Picturebox or Image Control.
Code:
'put this in the Declarations
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
Private Declare Function GetSysColor Lib "User32" (ByVal nIndex As Long) As Long
Code:
'use this to download image to harddrive
Dim strURL as String 'url of image
Dim strLocalFile as String ' file path to download to HDD
Dim lPic as Long,lCol as Long
lPic = URLDownloadToFile(0, strURL, strLocalFile, 0, 0)
' put an error trap here
'then load the image to the PictureBox with this
lCol = Picture1.BackColor
If lCol < 0 Then lCol = GetSysColor(lCol - &H80000000)
Token = InitGDIPlus
Picture1.Picture = LoadPictureGDIPlus(strLocalFile, , , lCol)
FreeGDIPlus Token
Let us know if it doesn't work.
Last edited by TheOldNewbie; Apr 17th, 2008 at 07:44 PM.
Dim byteData() As Byte
Dim xFile As Integer
byteData() = Inet1.OpenURL("http://ichart.finance.yahoo.com/b?s=DIS", icByteArray)
xFile = FreeFile
Open "C:\TempImage.jpg" For Binary Access Write As #xFile
Put #xFile, , byteData()
Close #xFile
If anyone finds out how to download it and put it directly on the picturebox or image control, please let me know. For now, ill just download it to the harddrive since its my only choice
This is some thing I D/L'd from some webpage but can not remember where, maybe PSC. Use the API below to download the png and then use the ZIP module to put it in a Picturebox or Image Control.
zip module? where do i get a zip module from? you got one i can have?