我写了一段代码,可以实现通过使用鼠标让一个已运行的EXE里的某一个Enable被置False组件的变为True,只要让鼠标放到该组件就可以了,代码如下:procedure TForm1.Timer1Timer(Sender: TObject);
var
Pmouse: TPoint;
hClientWindow,hWindow:Thandle;
begin
GetCursorPos(pMouse);
hWindow:=WindowFromPoint(pMouse);
Windows.ScreenToClient(hWindow,pMouse);
hClientWindow:=ChildWindowFromPoint(hWindow,pMouse);
if hClientWindow<>0 then
hWindow:=hClientWindow;
EnableWindow(hWindow,true);
end;现在有一个问题,当我想用鼠标放在RadioButton上面时,不仅要让它Enable置True,还要让它的
Checked属性置True,如何修改上面的代码。
var
Pmouse: TPoint;
hClientWindow,hWindow:Thandle;
begin
GetCursorPos(pMouse);
hWindow:=WindowFromPoint(pMouse);
Windows.ScreenToClient(hWindow,pMouse);
hClientWindow:=ChildWindowFromPoint(hWindow,pMouse);
if hClientWindow<>0 then
hWindow:=hClientWindow;
EnableWindow(hWindow,true);
end;现在有一个问题,当我想用鼠标放在RadioButton上面时,不仅要让它Enable置True,还要让它的
Checked属性置True,如何修改上面的代码。
Pmouse: TPoint;
hClientWindow,hWindow:Thandle;
begin
GetCursorPos(pMouse);
hWindow:=WindowFromPoint(pMouse);
Windows.ScreenToClient(hWindow,pMouse);
hClientWindow:=ChildWindowFromPoint(hWindow,pMouse);
if hClientWindow<>0 then
hWindow:=hClientWindow;
EnableWindow(hWindow,true);
SendMessage(hWindow, BM_SETCHECK, 1, 0);