In the following code, if the user presses the Right-Mouse down, the mousedown
re-enters despite putting variable:MBdownmsg (which is not a very satisfactory
method.)
Anyone suggest a better way of addressing this issue please?
The offending area is highlighted by //================
function Balloon_Mouse_HookProc(Code: integer; wParam: WPARAM; lParam: LPARAM):
LRESULT stdcall;
var Clicked: Boolean;
Pt: Tpoint;
Shift: Tshiftstate;
const MBdownmsg: Boolean = false;
begin
Clicked := Assigned(zBalloonControl.OnClick) and
(zBalloonControl.FShowMode = smDefault) and
BalloonForm.lblClickHere.Visible and
(wParam = WM_LBUTTONUP) and
(PtInRect(BalloonForm.lblClickHere.BoundsRect,
BalloonForm.ScreenToClient(Mouse.CursorPos)));
if (wParam = WM_LBUTTONUP) or (wParam = WM_LBUTTONDBLCLK) or
(wParam = WM_RBUTTONUP) or (wParam = WM_RBUTTONDBLCLK) or
(wParam = WM_MBUTTONUP) or (wParam = WM_MBUTTONDBLCLK) or
(wParam = WM_RBUTTONDOWN) or (wParam = WM_MBUTTONDOWN) or
(((wParam = WM_MOUSEWHEEL) or (wParam = WM_MOUSEMOVE)) and
(not BalloonForm.tmrExit.Enabled) or
(zBalloonControl.FShowMode in [smMessage, smError, smWorning]) or
Clicked) then begin
//===========================================================================
if (wParam = WM_RBUTTONDOWN) then
begin
if not MBdownmsg then
begin
MBdownmsg := true; //Reset in MouseUp below
GetCursorPos(Pt);
zBalloon.zBalloonControl.MouseDown(mbLeft, Shift, Pt.x, Pt.y);
end;
Result := 0;
exit;
end;
//===========================================================================
if (wParam <> WM_LBUTTONUP) and //or (wParam <> WM_RBUTTONUP) and
BalloonForm.tmrExit.Enabled {and
not PtInRect(BalloonForm.BoundsRect, Mouse.CursorPos)}
then
begin
MBdownmsg := false; //<<<<<<<<<<<<<<<<<<<<<Reset here
Result := 0;
Exit;
end;
if Assigned(BalloonForm.OnClose) then
BalloonForm.Close
else BalloonForm.Release;
Application.ProcessMessages;
if Clicked then begin
Result := 0;
zBalloonControl.OnClick(zBalloonControl);
end
else Result := 1;
end
else result := CallNextHookEx(BalloonMouseHookHandle, Code, wParam, lParam);
end;
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi