how to call "print screen" function

  • Thread starter Thread starter James
  • Start date Start date
J

James

hi!
in general we use "print screen" which on the keyboard to
store screen
i want to use c# write a windows form
how to do call the "print screen" function?

thank you :)
 
Try this (untested):


private const int VK_SNAPSHOT = 0x002C;
private const int KEYEVENTF_KEYUP = 0x0002;

[DllImport("user32.dll", CharSet=CharSet.Auto)]
static private extern void keybd_event(Byte bVk, Byte bScan, UInt32
dwFlags, IntPtr dwExtraInfo);

public void DoPrintScreen()
{
keybd_event(VK_SNAPSHOT, 0, 0, IntPtr.Zero);
keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, IntPtr.Zero);
}
 
Back
Top