Screen capture

  • Thread starter Thread starter Per
  • Start date Start date
P

Per

Hi all,
This may be a newbie question, but I can't find the answer anywhere.
I want to make a capture of the screen, or a part of the screen, that
contains the main portion of the form.
Detecting the screen that contain the main portion of the form is pretty
straight forward, but how do I capture what I need in an Image object?
Another thing, how do you make the program move the mouse pointer and
simulate clicks?

Best regards
 
To capture the complete screen:


Public Shared Function CaptureScreen() As Bitmap

Dim strKeys As String = "^{PRTSC}"
SendKeys.SendWait(strKeys)
Dim iData As IDataObject = Clipboard.GetDataObject()
If (iData.GetDataPresent(DataFormats.Bitmap)) Then
Dim memoryImage As New
Bitmap(CType(iData.GetData("System.Drawing.Bitmap"), Bitmap))
Return memoryImage
End If

'-- Unable to obtain screenShot from clipboard
Return Nothing
End Function


- José
 
Hi Per,

To move the mouse pointer and simulate clicks you can use SendInput function
(Win32 function).

Regards,
 
Back
Top