|
-
Dec 21st, 2008, 08:51 AM
#1
Thread Starter
Addicted Member
[RESOLVED] display image from webbrowser in a picture box?
How can i do the above ^^
Thanks
edit: and oh yeh not just a link of an image i mean from a tagid like :
Picture1.Image = WebBrowser1.Document.All.verificationImage
If anyone knows how to do this that would be great thanks
Last edited by Skunk1311; Dec 21st, 2008 at 09:01 AM.
-
Dec 21st, 2008, 04:18 PM
#2
Addicted Member
Re: display image from webbrowser in a picture box?
one way to do that is to open ur webbroswer code ("the html") like txt file. to look at the picture url in that txt then
download it to temp folder using DOWNLOADURLTOFILE. u can found it in KERNAL32.DLL. after u have the pic in the temp folder open it using pic.picture =loadpicture ("path")
IT CTO & System Administrator.
-
Dec 21st, 2008, 06:04 PM
#3
Thread Starter
Addicted Member
Re: display image from webbrowser in a picture box?
The picture URL is encrypted that is why i need to open it from its html tag
-
Dec 21st, 2008, 06:10 PM
#4
Re: display image from webbrowser in a picture box?
If you know the name of the image and it's complete URL then you can do something like below. Put a Inet control on your Form.
Code:
Private Sub Command1_Click()
Dim s1() As Byte
s1() = Inet1.OpenURL("http://www.website.com/image.jpg", icByteArray)
Open App.Path & "\image.jpg" For Binary As #1
Put #1, 1, s3
Close #1
Picture1.Picture = LoadPicture(App.Path & "\image.jpg")
End Sub
If you only know the name of the image but you do not know it's URL then you need to do something like this:
Code:
Private Sub Command2_Click()
Dim s1 As String
Dim s2 As String
Dim s3() As Byte
s1 = Inet1.OpenURL("http://www.website.com/")
q1 = InStr(1, s1, "image.jpg")
If q1 > 0 Then
For i = q1 To 1 Step -1
If Mid(s1, i, 7) = "http://" Then
q1 = q1 + Len("image.jpg")
s2 = Mid(s1, i, q1 - i)
Exit For
End If
Next i
End If
s3() = Inet1.OpenURL(s2, icByteArray)
Open App.Path & "\image.jpg" For Binary As #1
Put #1, 1, s3
Close #1
Picture1.Picture = LoadPicture(App.Path & "\image.jpg")
End Sub
-
Dec 21st, 2008, 06:27 PM
#5
Thread Starter
Addicted Member
Re: display image from webbrowser in a picture box?
Hi, thanks for your efforts 
But no, the picture does not have a specific name like image1.jpg , ill post the complete html code that covers the image and see if anyone can come up with anything.
vb Code:
<div id="verificationImage" name="verificationImage" style="padding-right: 5px"> <a href="#" onclick="document.verificationImg.src='/cimg?c=rxgb6NDa3Tun5uTk2xhVliD0PIKT9ZYixzPpVlG5LdNwAO3W8TG5IGlvckpABlI5XRjuP9QrgN0=&'+Math.random();return false"><img name="verificationImg" src="/cimg?c=rxgb6NDa3Tun5uTk2xhVliD0PIKT9ZYixzPpVlG5LdNwAO3W8TG5IGlvckpABlI5XRjuP9QrgN0=" align="texttop" border="0"></a> </div> </td> <td style="vertical-align: bottom"> <div class="formFieldInfo"> <a href="#" onclick="document.verificationImg.src='/cimg?c=rxgb6NDa3Tun5uTk2xhVliD0PIKT9ZYixzPpVlG5LdNwAO3W8TG5IGlvckpABlI5XRjuP9QrgN0=&'+Math.random();return false">New image</a> </div> </td> </tr> </table> </td> </tr> <tr> <td class="loginFormLabel"> <div id="verificationLabel" name="verificationLabel"> <label for="verificationResponse">Word Verification:</label> </div> </td> <td> <input id="verificationResponse" size="40" name="response" maxlength="10" value="" type="text"> <div class="formFieldInfo"> Enter the text in the image </div> <input type="hidden" name="challenge" value="rxgb6NDa3Tun5uTk2xhVliD0PIKT9ZYixzPpVlG5LdNwAO3W8TG5IGlvckpABlI5XRjuP9QrgN0="/> </td> </tr> <tr>
-
Dec 21st, 2008, 07:41 PM
#6
Re: display image from webbrowser in a picture box?
Drop a picturebox control to your form. This code will force the webbrowser control to copy the image content to the clipboard, that you can easily paste by using the Clipboard object of vb6
vb Code:
Dim O as Object Set O = WebBrowser1.Document.body.createControlRange() Call O.Add(WebBrowser1.Document.All("verificationImg")) Call O.execCommand("Copy") Set Picture1.Picture = Clipboard.GetData
Now what do you want to do with this (verification) image?
-
Dec 21st, 2008, 08:01 PM
#7
Thread Starter
Addicted Member
Re: display image from webbrowser in a picture box?
 Originally Posted by Jim Davis
Drop a picturebox control to your form. This code will force the webbrowser control to copy the image content to the clipboard, that you can easily paste by using the Clipboard object of vb6
vb Code:
Dim O as Object
Set O = WebBrowser1.Document.body.createControlRange()
Call O.Add(WebBrowser1.Document.All("verificationImg"))
Call O.execCommand("Copy")
Set Picture1.Picture = Clipboard.GetData
Now what do you want to do with this (verification) image?
Works like a charm Thank you so much.
And i just want to let people fill it in on my app but i have that covered thanks
-
Mar 16th, 2010, 01:56 PM
#8
New Member
Re: [RESOLVED] display image from webbrowser in a picture box?
And how to do this if verification img does not have a name:
<img src="/sw/verification/verif.php?c=login" alt="captcha" class="captcha"/>
Thanx a lot !
-
Apr 3rd, 2010, 02:31 PM
#9
Member
Re: [RESOLVED] display image from webbrowser in a picture box?
I get an error on this line:
Call O.Add(WebBrowser1.Document.All("verificationImg"))
-
May 11th, 2010, 12:55 PM
#10
New Member
Re: display image from webbrowser in a picture box?
 Originally Posted by Jim Davis
Drop a picturebox control to your form. This code will force the webbrowser control to copy the image content to the clipboard, that you can easily paste by using the Clipboard object of vb6
vb Code:
Dim O as Object
Set O = WebBrowser1.Document.body.createControlRange()
Call O.Add(WebBrowser1.Document.All("verificationImg"))
Call O.execCommand("Copy")
Set Picture1.Picture = Clipboard.GetData
Now what do you want to do with this (verification) image?
Thank you so much for this CODE.
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
|