怎么知道窗体上的哪个控件获得焦点
1个回答
展开全部
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;
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;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询