#コード(VBA)
'64bit版
Private Declare PtrSafe Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long _
)
'32bit版
'Private Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long _
)
Public Sub 全体を撮る()
keybd_event vbKeySnapshot, 0&, &H1, 0&
keybd_event vbKeySnapshot, 0&, &H1 Or &H2, 0&
End Sub
Public Sub アクティブ画面を撮る()
keybd_event &HA4, 0&, &H1, 0&
keybd_event vbKeySnapshot, 0&, &H1, 0&
keybd_event vbKeySnapshot, 0&, &H1 Or &H2, 0&
keybd_event &HA4, 0&, &H1 Or &H2, 0&
End Sub