Clicky!

How do you detect if the mouse is clicked out side the form? eg. the user click on the desktop or somewhere

Comments

  • Thats realy hard stuff.
    You have to hook into the windows message chain.
  • [b][red]This message was edited by injektilo at 2002-10-5 13:17:45[/red][/b][hr]
    [code]Application.HookMainWindow(MyHook);

    function MyHook(var Msg: TMessage): Boolean;
    begin
    Result := False;
    case Msg.Msg of
    . //check your messages
    .
    .
    end;
    end;
    [/code]
  • : How do you detect if the mouse is clicked out side the form? eg. the user click on the desktop or somewhere
    :
    if your form was the last active then catch the WM_KILLFOCUS event. The message should have an flag set indicating the focus was removed because of a click, if it's so simply read the properties of the Mouse object to get the mouse coords.
    if your form wasn't the last active you could call SetCapture() (win32 api function) but I don't know if this helps, because you the capture will be automaticaly removed from your form (or ani other winControl's handle you specify) if a click occurs, but I hope there will be some notification about the remove. Try to search MSD or Win32 api help for "setcapture".

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories