0

i can't seem to take a screenshot of any other window than the focused Form1.

At keypress, i can take a screenshot of Form1 window because it has focus. When it doesn't, nothing happens.

Tried to set KeyPreview to true on Form1 Properties, same happens.

Tried to set it true at FormCreate :

procedure TForm1.FormCreate(Sender: TObject);
begin
   Form1.KeyPreview := true;
end;

Still, I cant take a screenshot of third-party applications :(

Any help?

GolezTrol
  • 114,394
  • 18
  • 182
  • 210
  • 1
    What would you expect 'keypreview' does? It means that the form gets to check any keys before the control receives it. It still means that the form is active if it receives that key message. – GolezTrol Aug 05 '16 at 15:35
  • Ok, i thought it would check for keypresses on background before it sends any command to the form. Silly me :) Can you enlighten me then? How can I check for keypress without having focus on Form? – Flavio Correia Aug 05 '16 at 15:47
  • If your process is not in the foreground it won't receive input. Perhaps you are looking for a hotkey. – David Heffernan Aug 05 '16 at 16:12
  • So basically, open my window, click on form1.button1, and made form.1 hide and take a screenshot of the foreground window. I was just wondering if there is anyway of taking a screenshot not having focus on any form. thanks :) – Flavio Correia Aug 05 '16 at 19:37
  • You could make a [global keyboard hook](http://stackoverflow.com/questions/3156418/windows-global-keyboard-hook-delphi). That way you could have your application run in the background, listening for keystrokes. Or, maybe better, just use Alt+PrtScr. ;-) – GolezTrol Aug 05 '16 at 22:58

0 Answers0