Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PrintWindow function isnt working

Status
Not open for further replies.

wallstreetkid

Programmer
Aug 11, 2008
3
US
The printwindow function isnt working for me. Here is my code, could someone please tell me what is wrong with it?

Private Sub CaptureScreen(ByVal f As Control)
screen = New Bitmap(f.Width, f.Height)
Dim g As Graphics = Graphics.FromImage(screen)
Dim hdc As IntPtr = g.GetHdc
PrintWindow(f.Handle, hdc, Nothing)


g.ReleaseHdc(hdc)
g.Flush()
g.Dispose()

PictureBox1.Image = screen
End Sub
 
A little more detail please. Are you getting an error message? How exactly is it not working for you?



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Hi,

nothing is being drawn to the picturebox, it is just blank. I am 99% sure my code is correct too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top