I'm trying to capture (printscreen) part of the active window. I'm using this simple and efficient code from Lutz Gentkow that works like a charm to capture the whole active window, but I need to capture a defined part of the window only, say a 300 px w x 150 px h.
Option Explicit
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 KEYEVENTF_KEYUP = &H2
Private Const VK_SNAPSHOT = &H2C
Private Const VK_MENU = &H12
Sub AltPrintScreen()
keybd_event VK_MENU, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
End Sub
Also found this code from Zack Barresse that does what I want but for the Whole Screen, which make me believe it's possible but capturing from Whole Screen doesn't work for me as I use multiple screens.
Using windows API is out of my scope of knowledge so can anyone point me to the right direction on how to capture Part of the Active Window, eg defining StartLeft, StartTop, Width, Height ? by modifying one of this codes? Thanks