How to get ClassName of active form (may be from another application) on Delphi?
It seems Application.ActiveFormHandle returns active form of Application only.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The window handle that you are looking for is, I believe, returned by
GetForegroundWindow.To get the class name, pass that window handle to the Windows API function
GetClassName. Here’s a Delphi wrapper to that API function:I used a buffer of length 256 because window class names are not allowed to be longer than that.