I am using the following code to simulate a PrintScreen button press to capture the image of a Internet Explorer window. I have assigned Printscreen as a Hotkey in Greenshot tool to capture the image of the full page in one go without having to scroll.
Extern.Declare micLong, "PostMessage", "user32.dll", "PostMessageA", micHwnd, micLong, micLong, micLong
Const WM_KEYDOWN = 273
Const VK_SNAPSHOT = 44
iResult = Extern.PostMessage( Hwnd, WM_KEYDOWN, VK_SNAPSHOT, 0)
But somehow the value of iResult
is always 1. Hwnd
is the actual window handle of the Internet explorer window which is passed to the Postmessage
function. The reason why I am using this approach is because the screenshot capturing process needs to be automated completely and should run when the system is locked as well. SendKeys
does not work when system is locked and so I had to move to Post Message
.
Could someone please help me out with this.