Form - conseguir o caption do componente ativo mesmo em uma subform |
Top Previous Next |
|
// capturar o caption do componente corrente numa rotina // na form principal (independente de estar numa subform ou nao)
var I: Integer; A: array[1..255] of char; S: string; begin GetWindowText(GetForegroundWindow, @A, 255); S := StrPas(@A); for I := 0 to Screen.FormCount-1 do if Screen.Forms[I].Caption = S then Break; if Screen.Forms[I].ActiveControl is TWinControl then Caption := TWinControl(Screen.Forms[I].ActiveControl).Name; end;
|