Root > Reference > All Functions > GetActiveFormText

Function GetActiveFormText

Previous pageReturn to chapter overviewNext page   

Gets caption of active window.







Code (Delphi)

function GetActiveFormText(

const AWnd: HWND = 0

): String;


Return value

If the function succeeds and there is active window, the return value is caption of active window.


Sample output: 'XMLDocToXML - Embarcadero RAD Studio 2010 - ESysInfo'


If the function succeeds but there is no active window, the return value is empty string.


If the function fails, the return value is error message.



This function is combination of WM_GETTEXT message from GetForegroundWindow


This function uses a timeout of 100 ms. If active window is hung and not responding - function will fail after timeout. Therefore it's safe to call this function, no deadlock is possible.



Return value nevers contain line breaks.



See also

Send feedback... Build date: 2022-03-28
Last edited: 2022-03-28
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.

Permanent link to this article: