Delphi/Lazarus: Get Handle of focused Window
Question by Guest | 2016-01-18 at 18:46
Is it possible to determine the handle of the window that is currently active? I am talking about the window that has the focus at the moment and this window can also be the window of another application (not my own one). I am using the Windows operating system.
If possible, can someone give me an example code for that? I am really not good at all of this Windows API stuff.
Related Topics
Delphi: System-Wide HotKey
Tutorial | 1 Comment
Delphi/Lazarus: How to set up a Link to a Website in an Application
Tutorial | 0 Comments
Delphi: Global Treatment of Errors (Exceptions)
Tutorial | 0 Comments
Lazarus/Delphi: Width and ClientWidth - Difference
Info | 0 Comments
Delphi/Lazarus: 3 Ways to round a Number to X Decimal Places
Tutorial | 7 Comments
Delphi/Lazarus: Command Line Parameter Tutorial Part 1: Sending
Tutorial | 0 Comments
Delphi: Multiline Caption for TLabel (at Run Time and Design Time)
Tutorial | 1 Comment
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
That is really not a problem, you have even a function for that purpose, you only have to know its name. The function is called GetForegroundWindow and here I have a small example for usage:
This example stores the handle of the window that has the focus at present. If you are using Lazarus, do not forget to add the unit "Windows" to your "uses" section.
2016-01-18 at 21:43