procedure TForm1.ListBox1Click(Sender: TObject);
var
Msg: TMsg;
TargetTime: Longint;
begin
{ get the maximum time to wait for a double-click message }
TargetTime := GetTickCount + GetDoubleClickTime;
{ cycle until DblClick received or wait time run out }
while GetTickCount < TargetTime do
if PeekMessage(Msg, ListBox1.Handle, WM_LBUTTONDBLCLK,
WM_LBUTTONDBLCLK, WM_NOREMOVE)
then Exit; { Double click }
MessageDlg('Single clicked', mtInformation, [mbOK], 0);
end;
|