Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Screen

Status
Not open for further replies.

rraney

Programmer
May 18, 2000
11
0
0
US
Hello,

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.

Thanks

Raney
 
[tt]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

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]
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top