screen shot

leontager

Well-known member
Joined
Jun 17, 2003
Messages
89
how do i take a screen shot of the whole screen. if i take a screen shot using sendkeys then i for some reason i only get a picture of my program. Also how can i save it afterwards?
 
Alt-Prt Scr is for the active window. What you want is jsut the print screen button.

Then its in the clipboard, so you can extract it and save it from there.
 
i did type just print screen and it gave me active window only. on the code Shazbots gave me it says SendKeys.SendWait("{PRTSC 2}"). but i just figured out that active window should work for me. Thank you for your help
 
try the keyboard event api :)
Code:
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
/// then in a sub / click event...
        Dim VK_SNAPSHOT As Integer = &H2C
        keybd_event(VK_SNAPSHOT, 0, 0, 0)
 
here is code in c#

send it true if you only want the active window .. false if you want everything.
Code:
private Image GetScreenShot(bool activeWindowOnly)
{
  if(activeWindowOnly)
  {
    SendKeys.SendWait("%{PRTSC}");
  }
  else
  {
    SendKeys.SendWait("{PRTSC 2}");
  }

  return (Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap);
}
 
Back
Top