TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prasanth
NA
1
0
Screenshot of webbrowser control...
Dec 15 2007 11:49 AM
I needed Vb.NET code for capturing a screenshot of a webbrowser control........ the webbrowser may not be the first in zorder.. ie not on top.....
i tried both PrintWindow and WM_PRINT.. but both dowsn't work for me.. i get a black screenshot with PrintWindow (even if the webbrowser is on top of other controls and focussed...)....
code---
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim webWidth As Integer = WebBrowser1.Width
Dim webHeight As Integer = WebBrowser1.Height
Dim result As Boolean
Dim webHwnd As Long
webHwnd = WebBrowser1.Handle
Dim bitDest As New Bitmap(webWidth, webHeight)
Dim g As Graphics
g = Graphics.FromImage(bitDest)
Dim hdc As Long
hdc = g.GetHdc()
result = PrintWindow(webHwnd, hdc, 0)
g.ReleaseHdc(hdc)
g.Flush()
MsgBox(result)
If result Then
PictureBox1.Image = bitDest
bitDest.Save("c:\\bit.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
End If
end sub
Reply
Answers (
0
)
NP70 readonly Keyword
Image Location -> Mouse Location