VB Code:
Dim KeyASCII As Integer, Path As String
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Me.Hide
App.TaskVisible = False
AutoRedraw = True
'This is the path where all the screen shots go
Path = "C:\Screen Shots\"
End Sub
Private Sub Timer1_Timer()
For I = 1 To 255
KeyASCII = 0
KeyASCII = GetAsyncKeyState(I)
If KeyASCII <> 0 And I = vbKeyF12 Then
DeskhWnd& = GetDesktopWindow()
DeskDC& = GetDC(DeskhWnd&)
Form1.Height = Screen.Height
Form1.Width = Screen.Width
BitBlt Form1.hDC, 0&, 0&, Screen.Width, Screen.Height, DeskDC&, 0&, 0&, SRCCOPY
Dim Today As Variant, FileName As String
Today = Now
FileName = Format(Today, "ddd") & "-" & Format(Today, "dd") & "-" & Format(Today, "mmm") & "-" & Format(Today, "h`m`s") & ".bmp"
Open Path & FileName For Random As #1
Close
SavePicture Form1.Image, Path & FileName
End If
Next I
End Sub
VB Code:
Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Long) As Integer
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Public Const SRCCOPY = &HCC0020
Public Const SRCAND = &H8800C6
Public Const SRCINVERT = &H660046