Click to See Complete Forum and Search --> : How can I get screen shot from an app?
MrPolite
Oct 3rd, 2002, 10:21 PM
well, I dont want a screenshot of my own app, I want to be able to take a screenshot of a Process. I believe that I have to make it on top first. But how can I make it on top and how can I get a screenshot? I have no clue:confused:
Slow_Learner
Oct 4th, 2002, 01:18 AM
Here's a sample cut/pasted from AllAPI that looks like it does what you want, but it's in VB6... not sure if it will work the same in .NET. Hope it helps.
Private Declare Function PrintWindow Lib "user32" (ByVal hWnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Form_Load()
'KPD-Team 2001
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim mWnd As Long
'launch notepad
Shell "notepad.exe", vbNormalNoFocus
DoEvents
'set the graphics mode to persistent
Me.AutoRedraw = True
'search the handle of the notepad window
mWnd = FindWindow("Notepad", vbNullString)
If mWnd = 0 Then
Me.Print "NotePad window not found!"
Else
'draw the image of the notepad window on our form
PrintWindow mWnd, Me.hDC, 0
End If
End Sub
MrPolite
Oct 4th, 2002, 03:47 PM
tnx Slow_Learner
for some reason I cant make it to work in VB.NET...it works fine in vb6
I checked the return value of the function in VB.NET, it doesnt return any error codes, so I'm assuming that it should work, but it doesnt
I have a picturebox and I'm passing the handle.toint64 of the form and the picturebox to the function, doenst work :confused:
Slow_Learner
Oct 4th, 2002, 07:40 PM
Dunno, I haven't messed with graphics at all except for your windowshade thingy (which I didn't get to work heh).
Musician
Oct 5th, 2002, 09:01 PM
Make sure you have converted that api function correct for vb.net - i.e. a long in vb6 is an integer now in vb.net etc.
MrPolite
Oct 5th, 2002, 09:04 PM
yeah I've done that already, aint working
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.