ScreenShot




Private 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 = &H12
Private Const VK_SNAPSHOT = &H2C
Private Const KEYEVENTF_KEYUP = &H2
Private Declare Function MapVirtualKey Lib "user32" _
Alias "MapVirtualKeyA" (ByVal wCode As Long, _
ByVal wMapType As Long) As Long
Private Sub Command1_Click()
#Const WINDOWS_VERSION = "Windows2000"
Dim alt_key As Long
'Cattura l'immagine del form nella clipboard.

'Premi Alt.

alt_key = MapVirtualKey(VK_MENU, 0)
keybd_event VK_MENU, alt_key, 0, 0
DoEvents
'Premi Print Scrn.

#If WINDOWS_VERSION = "Windows2000" Then
keybd_event VK_SNAPSHOT, 0, 0, 0
#Else
keybd_event VK_SNAPSHOT, 1, 0, 0
#End If
DoEvents
'Rilascia Alt.

keybd_event VK_MENU, alt_key, KEYEVENTF_KEYUP, 0
DoEvents
End Sub

This program did not work in Windows 2000.
This version fixes the problem. Look for the
"#If WINDOWS_VERSION..." line to see the change.











( screenshot.html )- by Paolo Puglisi - Modifica del 17/12/2023