function TMainForm.HookProce(Code:Integer;WparamongInt;MsgongInt)ongInt;
var
vClassName : String; //组件类名
Caption:String;
StringList : TStringList;
begin
StringList := TStringList.Create;
StringList.Add('button2');
StringList.Add('button3');
StringList.Add('button4');
try
if MainForm.vDown then //按钮面板已出现
begin
if Code = HC_Action then
begin
if self.ScreenToClient(Borland.Delphi.Windows.PMsg(Msg).pt).Y < Panel1.Top + Panel1.Height then //判断鼠标点击的区域
begin
if Msg.message = Borland.Delphi.Messages.WM_LBUTTONUP then
begin
GetClassName(Msg.hwnd,vClassName,255);
if StrPas(vClassName)='TButton' then
begin
GetWindowText(Msg.hwnd,Caption,sizeof(caption)-1);
if StringList.IndexOf(Caption) <0 then
begin
ControlPanel('');
end;
end;
end
end
else begin
if Msg.message = WM_LBUTTONDOWN then
begin
MainForm.vDown := false;
timer1.Enabled := true;
end;
end;
end;
end;
result := CallNextHookEx(HOOKHandle,Code,WParam,Msg);
finally
StringList.Free;
end;
end;