I would like to add a Print Screen function to a tools menu that I have.
I would like this to print whatever is on the current screen. I have looked for an API Function,but cant seem to find what I am looking for.
[tt]Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Function SaveScreen(sFile As String) As Boolean
Dim sPic As IPictureDisp
On Error GoTo Errhandler
Clipboard.Clear
keybd_event VK_MENU, 0, 0, 0
DoEvents
keybd_event VK_SNAPSHOT, 1, 0, 0
DoEvents
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
DoEvents
Set sPic = Clipboard.GetData(0)
SavePicture sPic, sFile
Clipboard.Clear
Set sPic = Nothing
SaveDesktop = True
Errhandler:
End Function
Private Sub cmdScreenToBMP_Click()
SaveScreen "My.bmp"
End Sub
[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.