Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

Biblioteca para Operações com Mouse

Collapse
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    Delphi Biblioteca para Operações com Mouse

    Código PHP:
    unit tbMouse;
     
    interface
     
    uses WindowsControlsMessagesForms;
     
    Simula click de mouse }
    procedure MouseClick(const DurationWord);
    Aprisiona o mouse em um retângulo }
    function 
    MouseClip(const RctTRect): boolean;
    Retorna o número de botões do mouse }
    function 
    MouseGetButtonsbyte;
    Retorna a posição do mouse }
    function 
    MouseGetPos(var PtTPoint): boolean;
    Retorna true se o mouse está sobre a janela }
    function 
    MouseInWindow(const WinHandleHWnd): boolean;
    Retorna true se o mouse está configurado }
    function 
    MouseIsPresentboolean;
    Move o ponteiro do mouse para um controle (componente visual) }
    function 
    MouseMoveToControl(const ControlTControl): boolean;
    Define a posição do mouse }
    function 
    MouseSetPos(const PtTPoint): boolean;
    Exibe ou oculta o ponteiro do mouse }
    function 
    MouseShowCursor(const Showboolean): boolean;
    Deslisa o ponteiro do mouse até um controle }
    function 
    MouseSlideToControl(const ControlTControlJumpJumpTimeWord): boolean;
    Inverte os botões do mouse }
    function 
    MouseSwapButtons(const Swapboolean): boolean;
    Retorna true se os botões estão invertidos }
    function 
    MouseSwappedButtonsboolean;
    Libera o mouse previamente aprisionado com MouseClip }
    function 
    MouseUnClipboolean;
     
    implementation
     
    { *** Mouse *** }
    procedure MouseClick(const DurationWord);
    var
      
    WinHWnd;
      
    PtTPoint;
      
    MsgTMsg;
      
    FlagMouseDownFlagMouseUpDWord;
    begin
      
    Se os botões estiverem invertidos... }
      if 
    MouseSwappedButtons then begin
      FlagMouseDown 
    := MOUSEEVENTF_RIGHTDOWN;
      
    FlagMouseUp := MOUSEEVENTF_RIGHTUP;
      
    end else begin; { Se os botões estiverem normais... }
      
    FlagMouseDown := MOUSEEVENTF_LEFTDOWN;
      
    FlagMouseUp := MOUSEEVENTF_LEFTUP;
      
    end;
     
      { 
    Obtém o handle da janela que está sob o cursor }
      
    Windows.GetCursorPos(Pt);
      
    Win := Windows.WindowFromPoint(Pt);
     
      { 
    Inicia o click }
      
    mouse_event(FlagMouseDown0000);
     
      { 
    Processa as mensagens do mouse pertencentes à janela sob o cursor }
      while 
    PeekMessage(MsgWinWM_LBUTTONDOWNWM_LBUTTONDOWNPM_REMOVE) do
      
    DispatchMessage(Msg);
     
      
    Sleep(Duration);
     
      { 
    Conclui o click }
      
    mouse_event(FlagMouseUp0000);
    end;
     
    function 
    MouseClip(const RctTRect): boolean;
    begin
      Result 
    := Windows.ClipCursor(@Rct);
    end;
     
    function 
    MouseGetButtonsbyte;
    begin
      Result 
    := GetSystemMetrics(SM_CMOUSEBUTTONS);
    end;
     
    function 
    MouseGetPos(var PtTPoint): boolean;
    begin
      Result 
    := Windows.GetCursorPos(Pt);
    end;
     
    function 
    MouseInWindow(const WinHandleHWnd): boolean;
    var
      
    PtTPoint;
    begin
      Result 
    := GetCursorPos(Pt) and (WindowFromPoint(Pt) = WinHandle);
    end;
     
    function 
    MouseIsPresentboolean;
    begin
      Result 
    := GetSystemMetrics(SM_MOUSEPRESENT) <> 0;
    end;
     
    function 
    MouseMoveToControl(const ControlTControl): boolean;
    var
      
    PtTPoint;
    begin
      Pt
    .:= Control.Width div 2;
      
    Pt.:= Control.Height div 2;
      
    Pt := Control.ClientToScreen(Pt);
      
    Result := SetCursorPos(Pt.XPt.Y);
    end;
     
    function 
    MouseSetPos(const PtTPoint): boolean;
    begin
      Result 
    := Windows.SetCursorPos(Pt.XPt.Y);
    end;
     
    function 
    MouseShowCursor(const Showboolean): boolean;
    var
      
    Iinteger;
    begin
      I 
    := ShowCursor(LongBool(true));
      if 
    Show then begin
      
    ShowCursor(trueincrementa um contador interno do Windows.
      
    Quando este contador ficar >= 0então o cursor é exibido }
      
    Result := >= 0;
      while 
    do begin
      Result 
    := ShowCursor(LongBool(true)) >= 0;
      
    Inc(I);
      
    end;
      
    end else begin
      
    ShowCursor(falsedecrementa um contador interno do Windows.
      
    Quando este contador ficar 0então o cursor é ocultado }
      
    Result := 0;
      while 
    >= do begin
      Result 
    := ShowCursor(LongBool(false)) < 0;
      
    Dec(I);
      
    end;
      
    end;
    end;
     
    function 
    MouseSlideToControl(const ControlTControlJumpJumpTimeWord): boolean;
    var
      
    ToPointPtTPoint;
     
      function 
    ExecJumpboolean;
      
    begin
      
    if (Pt.ToPoint.x) and (Pt.ToPoint.ythen begin
      Result 
    := false; { Chegou }
      Exit;
      
    end;
      { 
    Calcula X }
      if 
    Pt.ToPoint.x then begin
      Inc
    (Pt.xJump);
      if 
    Pt.ToPoint.x then Se passou... }
      
    Pt.:= ToPoint.x;
      
    end else if Pt.ToPoint.x then begin
      Dec
    (Pt.xJump);
      if 
    Pt.ToPoint.x then
      Pt
    .:= ToPoint.x;
      
    end;
      { 
    Calcula Y }
      if 
    Pt.ToPoint.y then begin
      Inc
    (Pt.yJump);
      if 
    Pt.ToPoint.y then Se passou... }
      
    Pt.:= ToPoint.y;
      
    end else if Pt.ToPoint.y then begin
      Dec
    (Pt.yJump);
      if 
    Pt.ToPoint.y then
      Pt
    .:= ToPoint.y;
      
    end;
      
    Result := SetCursorPos(Pt.xPt.y);
      
    end;
     
    begin
      
    if Jump 0 then
      Jump 
    := 1;
     
      
    SetCursor(Screen.Cursors[Control.Cursor]);
      
    with Control do begin
      ToPoint
    .:= Width div 2;
      
    ToPoint.:= Height div 2;
      
    ToPoint := ClientToScreen(ToPoint);
      
    end;
      if 
    GetCursorPos(Ptthen
      
    while ExecJump do Sleep(JumpTime);
     
      
    Result := GetCursorPos(Pt) and
      (
    Pt.ToPoint.x) and (Pt.ToPoint.y);
    end;
     
    function 
    MouseSwapButtons(const Swapboolean): boolean;
    begin
      Result 
    := Windows.SwapMouseButton(LongBool(Swap));
    end;
     
    function 
    MouseSwappedButtonsboolean;
    begin
      Result 
    := GetSystemMetrics(SM_SWAPBUTTON) <> 0;
    end;
     
    function 
    MouseUnClipboolean;
    begin
      Result 
    := Windows.ClipCursor(nil);
    end;
     
    end
    ~# Criado pela [IN]Segurança #~

  • Font Size
    #2
    Como já disse,
    isso que é material de qualidade =)
    Vlws
    A porta mais bem fechada é aquela que pode ser deixada ABERTA
    Honeypot neles heheh


    [========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========]

    Comment


    • Font Size
      #3
      estava precisando para implementação em um joguinho aqui, quando eu termina-lo eu posto aqui pra galera ver,

      vlw's
      sigpic
      __________Prazer, sou Zaraki Kenpachi, e vim te matar.__________
      Bankai is for the weaks!



      | HD no 4Shared |-| Anime~No~Cn |

      Comment

      X
      Working...
      X