unit frm_Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TfrmMain =
class(TForm)
Panel1: TPanel;
procedure FormKeyPress(Sender: TObject;
var Key: Char);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
function FindDisabledWinControl(AControl: TWinControl; Pos: TPoint): TWinControl;
var
frmMain: TfrmMain;
implementation
{$R *.dfm}
function FindDisabledWinControl(AControl: TWinControl; Pos: TPoint): TWinControl;
var
AChildHandle: HWND;
APrevChildHandle: HWND;
APos: TPoint;
begin
Result :=
nil;
AChildHandle := 0;
APrevChildHandle := AControl.Handle;
APos := AControl.ScreenToClient(Pos);
repeat
if AChildHandle <> 0
then
APrevChildHandle := AChildHandle;
if(Result <>
nil)
then
APos := Result.ScreenToClient(Pos);
AChildHandle := ChildWindowFromPointEx(APrevChildHandle, APos, CWP_ALL);
Result := FindControl(AChildHandle);
until (AChildHandle = 0)
or (AChildHandle = AControl.Handle)
or
(AChildHandle = APrevChildHandle);
Result := FindControl(APrevChildHandle);
end;
procedure TfrmMain.FormKeyPress(Sender: TObject;
var Key: Char);
Var
AControl: TWinControl;
begin
if key = '
1'
then
begin
AControl := FindDisabledWinControl(Self, Mouse.CursorPos);
if AControl <>
nil then
MessageDlg(AControl.
Name, mtInformation, [mbOK], 0);
end;
end;
end.