• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

[VB] Screen Dump

Carmen

Member
Hi all,I've try to use the following code to write a PrintScreen function and save it to an image,
however, the image saved is not the instant one, but from the last PrintScreen, why is that?
How to solve it? Thanks

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_SNAPSHOT = &H2C

Private Function SaveScreen(ByVal theFile As String) As Boolean
On Error Resume Next

'To get the Entire Screen
Call keybd_event(vbKeySnapshot, 1, 0, 0)

'To get the Active Window
Call keybd_event(vbKeySnapshot, 0, 0, 0)

SavePicture Clipboard.GetData(vbCFBitmap), theFile

SaveScreen = True
Exit Function
End Function

Private Sub cmdEnd_Click()
Call SaveScreen("C:\Windows\Desktop\shot1.gif&quot😉
End
End Sub

 
Back
Top