GetWindowSnapShot
This allows a VB program to capture either the screen or the program window. It has been tested under Win95 and NT4.0. It derives from a routine by Dan Appleman (VisualBasic 5.0 Programmer's Guide to the WIN32 API, page 303) which unfortunately does not work reliably under all conditions. Dan Appleman's exhaustive preliminary tutorial, though, is all it takes to understand the code.
AI
สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
ซอร์สโค้ด
'Insert this in a module: Public Sub GetWindowSnapShot(Mode As Long, ThisImage As Image) ' mode = 0 -> Screen snapshot ' mode = 1 -> Window snapshot Dim altscan%, NT As Boolean, nmode As Long NT = IsNT If Not NT Then If Mode = 0& Then Mode = 1& Else Mode = 0& End If If NT And Mode = 0 Then keybd_event vbKeySnapshot, 0&, 0&, 0& Else altscan = MapVirtualKey(VK_MENU, 0) keybd_event VK_MENU, altscan, 0, 0 DoEvents keybd_event vbKeySnapshot, Mode, 0&, 0& End If DoEvents ThisImage = Clipboard.GetData(vbCFBitmap) keybd_event VK_MENU, altscan, KEYEVENTF_KEYUP, 0 End Sub Public Function IsNT() As Boolean Dim verinfo As OSVERSIONINFO verinfo.dwOSVersionInfoSize = Len(verinfo) If (GetVersionEx(verinfo)) = 0 Then Exit Function If verinfo.dwPlatformId = 2 Then IsNT = True End Function Upload
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine