PDA

Click to See Complete Forum and Search --> : print screen in windows 2000


neo_spawn
Jan 25th, 2002, 01:10 PM
What is the api call to print screen? The old api I used on winnt does not seem to work.

Thanks

Hack
Jan 25th, 2002, 01:57 PM
Try thisPrivate Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const VK_MENU As Byte = &H12
Private Const VK_SNAPSHOT As Byte = &H2C
Private Const KEYEVENTF_KEYUP = &H2

Private Sub cmdPrintScreen_Click()
Dim lHeight As Long
Clipboard.Clear
Call keybd_event(VK_SNAPSHOT, 1, 0, 0)
DoEvents
Call keybd_event(VK_SNAPSHOT, 1, KEYEVENTF_KEYUP, 0)
Printer.Print
lHeight = (Printer.ScaleWidth / Screen.Width) * Screen.Height
Printer.PaintPicture Clipboard.GetData, 0, 0, Printer.ScaleWidth, lHeight
Printer.EndDoc
End Sub