一、添加[Additional]页下的[TApplicationEvents]控件函数
二、申请全局的Integer变量,用来计算延时,如:YsNum: Integer;orm
三、在ApplicationEvents1的OnMessage事件中,对捕获的WM_LBUTTONDOWN消息进行处理事件
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);it
beginio
case Msg.message of
WM_LBUTTONDOWN: begin
YsNum:= GetTickCount;
end;编译
end;
end;变量
四、而后在相应控件的OnMouseUp事件中进行延时处理di
……cas
begin消息
{$WARNINGS OFF} //使用GetTickCount函数,编译时会产生一个WARNINS的提示,在此可将WARNINGS开关关闭
if GetTickCount - YsNum > 500 then //此处500为延时500ms
begin
//==========在此处填写你本身的代码==========
end;
{$WARNINGS ON}
end;
五、若是控件没有OnMouseUp事件,可在第3步中的OnMessage事件中对WM_LBUTTONUP消息进行处理便可