怎么知道窗体上的哪个控件获得焦点
如何知道窗体上的哪个控件获得焦点?
如题,有不用循环的吗?
------解决方案--------------------
HWND GetFocus(VOID);
The GetFocus function retrieves the handle of the window that has the keyboard focus, if the window is associated with the calling thread 's message queue.
测试代码:
var
FocusHandle : THandle;
Buffer : Array [0..255] of Char;
begin
FocusHandle := GetFocus;
GetClassName ( FocusHandle, Buffer, 256 );
ShowMessage ( Buffer );
end;
------解决方案--------------------
var
s:string;
begin
s:=Activecontrol.Name;
ShowMessage(s);
end;
------解决方案--------------------
Activecontrol
------解决方案--------------------
Activecontrol
如题,有不用循环的吗?
------解决方案--------------------
HWND GetFocus(VOID);
The GetFocus function retrieves the handle of the window that has the keyboard focus, if the window is associated with the calling thread 's message queue.
测试代码:
var
FocusHandle : THandle;
Buffer : Array [0..255] of Char;
begin
FocusHandle := GetFocus;
GetClassName ( FocusHandle, Buffer, 256 );
ShowMessage ( Buffer );
end;
------解决方案--------------------
var
s:string;
begin
s:=Activecontrol.Name;
ShowMessage(s);
end;
------解决方案--------------------
Activecontrol
------解决方案--------------------
Activecontrol