1. Este site usa cookies. Ao continuar a usar este site está a concordar com o nosso uso de cookies. Saber Mais.

Posição do cursor

Discussão em 'Programação' iniciada por MarcoManetta, 30 de Abril de 2008. (Respostas: 6; Visualizações: 764)

  1. Estou fazendo um programa que necessita posicionar o cursor do mouse num ponto exato de um picture. Para isso estou usando a função SetCursorPos, mas, conforme o tema usado pelo computador do cliente, a posição sai errada. Alguém poderia me ajudar com uma dica ?
    Obrigado
     
  2. Oi Mary_C o trabalho vai indo...pretendo acabar hoj mesmo, o mais tardar amanhã...mas preciso de mais uma ajudinha...alguém me sabe explicar como utilizo a propriedade vbQuestion para por num botão "sair"? para aparecer uma coisa do genero... "Tem a certeza k deseja sair?" SIm ou Ñ...eu ñ sei que codigo devo usar para sair ou ñ, conforme a escolha...agradeço desde já a disponibilidade dakeles k me têm ajudado...
     
  3. jpaulino

    jpaulino Power Member


    Código:
     
    If MsgBox("Tem a certeza k deseja sair?", vbQuestion + vbYesNo) = vbYes Then
        End
    End If
    
     
  4. jpaulino

    jpaulino Power Member

    Marco é melhor criares um novo tópico!
     
  5. Brigado jpaulino... ;)
     
  6. em vez de escrever coordenadas vê se dá para mover o rato para cima de onde queres ir, percebes??

    por ex:

    em vez de MandarPonteiroPara 100px,200px

    tenta: MandarPonteiroPara ObjectoXPTO

    acho que existe algo que dá para aplicar isso
     
  7. RuiBranco

    RuiBranco Folding Member

    eu n sei em que lingua estas a fazer isso mas eu á uns anos fiz uma tool que consiste em mover o mouse para onde eu quiser neste caso é um anti-idle mete o mouse a mover sem parar com a função SetCursorPos


    mostro aqui o source para veres se ajuda

    Código:
    nomainwin
        WindowWidth = 372
        WindowHeight = 265
        UpperLeftX=int((DisplayWidth-WindowWidth)/2)
        UpperLeftY=int((DisplayHeight-WindowHeight)/2)
    
        groupbox #main.groupbox1, "Select interval",  0,0,0,0
    
        button #main.button1,"Exit",[quit.main], UL, 265, 192,  90,  25
        button #main.button2,"Stop now",[button2Click], UL, 265,  122,  90,  50
        button #main.button3,"Start now",[button3Click], UL, 265,  64,  90,  50
        button #main.button4,"About",[button4Click], UL,  10, 192,  90,  25
        button #main.button5,"",[button5Click], UL,  100, 192,  13,  25
    
        bmpbutton #main.arrow, "logo.bmp", [arrowClicked], UL, 0, -2
    
        radiobutton #main.radiobutton2, "5 Seconds", [radiobutton2Set], [radiobutton2Reset],  25,  87,  89,  25
        radiobutton #main.radiobutton3, "10 Seconds", [radiobutton3Set], [radiobutton3Reset],  25,  127,  96,  25
        radiobutton #main.radiobutton4, "15 Seconds", [radiobutton4Set], [radiobutton4Reset], 145,  87,  96,  25
        radiobutton #main.radiobutton5, "20 Seconds", [radiobutton5Set], [radiobutton5Reset], 145,  127,  96,  25
    
        open "Anti idle" for window_nf as #main
        print #main, "font arial 9"
        print #main, "trapclose [quit.main]"
        #main.arrow,"disable"
        #main.groupbox1, "!Locate 10,  57, 245, 115"
        #main "refresh"
    
    hTip=CreateTooltip(Hwnd(#main.button1))
    Call AddToolTip Hwnd(#main.button1) , hTip , "Close Anti idle"
    
    hTip=CreateTooltip(Hwnd(#main.button2))
    Call AddToolTip Hwnd(#main.button2) , hTip , "Stop Anti idle"
    
    hTip=CreateTooltip(Hwnd(#main.button3))
    Call AddToolTip Hwnd(#main.button3) , hTip , "Start Anti idle"
    
    hTip=CreateTooltip(Hwnd(#main.button4))
    Call AddToolTip Hwnd(#main.button4) , hTip , "About Anti idle"
    
    hTip=CreateTooltip(Hwnd(#main.button5))
    Call AddToolTip Hwnd(#main.button5) , hTip , "Menu..."
    
        wait
    
    
    [radiobutton2Set]
    #main.radiobutton2,"set"
    #main.radiobutton3,"reset"
    #main.radiobutton4,"reset"
    #main.radiobutton5,"reset"
    time$ = "5"
        wait
    
    [radiobutton2Reset]
        wait
    
    
    [radiobutton3Set]
    #main.radiobutton2,"reset"
    #main.radiobutton3,"set"
    #main.radiobutton4,"reset"
    #main.radiobutton5,"reset"
    time$ = "10"
        wait
    
    [radiobutton3Reset]
        wait
    
    [radiobutton4Set]
    #main.radiobutton2,"reset"
    #main.radiobutton3,"reset"
    #main.radiobutton4,"set"
    #main.radiobutton5,"reset"
    time$ = "15"
        wait
    
    [radiobutton4Reset]
        wait
    
    [radiobutton5Set]
    #main.radiobutton2,"reset"
    #main.radiobutton3,"reset"
    #main.radiobutton4,"reset"
    #main.radiobutton5,"set"
    time$ = "20"
        wait
    
    [radiobutton5Reset]
        wait
    
    
    [button2Click]
    
        timer 0
        #main.button3, "!enable"
    
        #main.radiobutton2,"enable"
        #main.radiobutton3,"enable"
        #main.radiobutton4,"enable"
        #main.radiobutton5,"enable"
    
        wait
    
    [button3Click]
    
        if time$ = "" then wait
        #main.button3, "!disable"
    
        #main.radiobutton2,"disable"
        #main.radiobutton3,"disable"
        #main.radiobutton4,"disable"
        #main.radiobutton5,"disable"
    
    hWnd = hWnd(#main)
    stateflag = 2
    CallDLL #user32, "ShowWindow", _
    hWnd As long, _
    stateflag As long, _
    result As boolean
    
         if time$ = "5" goto [next5]
         if time$ = "10" goto [next10]
         if time$ = "15" goto [next15]
         if time$ = "20" goto [next20]
    wait
    
    [loop5]
    timer 5000, [next5]
    wait
    [next5]
    cursor arrow
    x = 500
    [start5]
        CallDLL #user32, "SetCursorPos", _
            x as Long, _
           400 as Long, _
            result as Void
    x = x + 20
    if x = 800 goto [loop55]
    timer 10,[start5]
    wait
    
    [loop55]
    cursor arrow
    x = 800
    [start55]
    CallDLL #user32, "SetCursorPos", _
            x as Long, _
            400 as Long, _
            result as Void
    x = x - 20
    if x = 400 goto [loop5]
    timer 10,[start55]
    wait
    
    
    [loop10]
    timer 10000, [next10]
    wait
    [next10]
    cursor arrow
    x = 500
    [start10]
        CallDLL #user32, "SetCursorPos", _
            x as Long, _
            400 as Long, _
            result as Void
    x = x + 20
    if x = 800 goto [loop100]
    timer 10,[start10]
    wait
    
    [loop100]
    cursor arrow
    x = 800
    [start100]
    CallDLL #user32, "SetCursorPos", _
            x as Long, _
            400 as Long, _
            result as Void
    x = x - 20
    if x = 400 goto [loop155]
    timer 10,[start100]
    wait
    
    [loop15]
    timer 15000, [next15]
    wait
    [next15]
    cursor arrow
    x = 500
    [start15]
        CallDLL #user32, "SetCursorPos", _
            x as Long, _
            400 as Long, _
            result as Void
    x = x + 20
    if x = 800 goto [loop155]
    timer 10,[start15]
    wait
    
    [loop155]
    cursor arrow
    x = 800
    [start155]
    CallDLL #user32, "SetCursorPos", _
            x as Long, _
            400 as Long, _
            result as Void
    x = x - 20
    if x = 400 goto [loop15]
    timer 10,[start155]
    wait
    
    [loop20]
    timer 20000, [next20]
    wait
    [next20]
    cursor arrow
    x = 500
    [start20]
        CallDLL #user32, "SetCursorPos", _
            x as Long, _
            400 as Long, _
            result as Void
    x = x + 20
    if x = 800 goto [loop200]
    timer 10,[start20]
    wait
    
    [loop200]
    cursor arrow
    x = 800
    [start200]
    CallDLL #user32, "SetCursorPos", _
            x as Long, _
            400 as Long, _
            result as Void
    x = x - 20
    if x = 400 goto [loop20]
    timer 10,[start200]
    wait
    
    [button4Click]
               t$=CHR$(13)+  "Anti idle" +_
               CHR$(13)+_
               CHR$(13)+  "For suggestions or questions sends email:" +_
               CHR$(13)+  "Rui Branco ([email protected]) - code" +_
               CHR$(13)+ "Visit our official http://clientes.netvisao.pt/whitehat/at/"+_
               CHR$(13)+_
               CHR$(13)+ "(C) Copyright Portuguese team 2006-2007. All rights reserved."
    
       calldll #user32, "MessageBeep", _MB_ICONINFORMATION  as long, beepResult as boolean
    
        mbflags = _MB_ICONINFORMATION OR _MB_OK
    
        calldll #user32, "MessageBoxA", _
        0 as long, _
        t$ as ptr, _
        " Anti idle - About" as ptr, _
        mbflags as long, _
        mbResult as long
        wait
    
    [button5Click]
    popupmenu "Go to Official site", [site]
    wait
    
    [site]
    CALLDLL #shell32,"ShellExecuteA",0 As Ulong,"" As Ptr, "http://clientes.netvisao.pt/whitehat/at/" As Ptr,"" As Ptr,"" As Ptr,1 As Long,ShellExecute As Long
        wait
    
    [quit.about]
        close #about
        wait
    
    [quit.main]
        close #main
        end
    
    sub AddToolTip cHndl, hWnd, text$ 
    TOOLINFO.uId.struct = cHndl
    TOOLINFO.lpszText.struct = text$
    callDLL #user32, "SendMessageA",_
    hWnd As long, _
    1028 As long, _
    0 As long, _
    TOOLINFO as ptr, _
    result as long
    end sub
    
    Function CreateTooltip(hMain)
    Struct TOOLINFO, _
    cbSize As long, _
    uFlags As long, _
    hwnd As long, _
    uId As long, _
    rectLeft As long, _
    rectTop As long, _
    rectRight As long, _
    rectBottom As long, _
    hinst As long, _
    lpszText As ptr
    callDLL #comctl32,"InitCommonControlsEx", _
    result as void
    TOOLINFO.cbSize.struct = Len(TOOLINFO.struct)
    TOOLINFO.uFlags.struct = flags Or 17
    TOOLINFO.hwnd.struct = hMain
    callDLL #user32,"CreateWindowExA",_
    0 As long, _
    "tooltips_class32" As ptr, _
    0 As long, style As long, _
    _CW_USEDEFAULT As long, _
    _CW_USEDEFAULT As long, _
    _CW_USEDEFAULT As long, _
    _CW_USEDEFAULT As long, _
    hMain As long, _
    0 As long, _
    0 as long, _
    0 As long, _
    CreateTooltip As Long
    End Function
    
    Function IsWindow(hWnd)
    callDll #user32, "IsWindow", hWnd As Ulong, IsWindow As Boolean
    End Function
    
    
    
     
    Última edição: 1 de Maio de 2008

Partilhar esta Página