Jump to content
Sign in to follow this  
rush4hire

ControlMouseDown() ? .. and up ?

Recommended Posts

If there's a button you want to be held down for a certain amount of time. Like say you want to hold down left mid mouse, and when you do that it will hold down a button in a gui that's not showing.

Like the Talk button in Yahoo chat for instance.

I know you can mess with those cause when Ido this:

ControlCommand ( $windowname, '', 202 , "Check", "")

it works

Btw.. I have searched...

Thanks.

Edited by rush4hire

Share this post


Link to post
Share on other sites

Ya I thought about that.

B

I will use some parts from _IsPressed and this _MouseClickPlus I saw...

Have to get into some funky dllCall stuff. Look at how _mouseClickPlus works. Just modify that to send mouseDown. When you let up on your hotkey it will send mouse up.

Will get the coordinants of the button with ControlGetPos ( "title", "text", controlID )

I have some other stuff I'm doin, but when I'm done I'll do this and show you here.

Ya i figured this one out. Was just too tired last night....

Share this post


Link to post
Share on other sites

I don't know why this doesn't work.

Test shows the function to be firing and it gives the coordinants.

It's something in the DllCalls

; yahoo push to talk

Global $dll = DllOpen('user32.dll')
; yahoo chat room window
Global $window = "Kansas:"
; push to talk hotkey
Global $talkhotkey = 0x04; mid mouse
Global $bdown = 0

Func _MakeLong($LoWord,$HiWord)
  Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc

Func closedll()
    DllClose($dll)
EndFunc

Opt("OnExitFunc","closedll")
Opt("MouseCoordMode",0)

; modified from _IsPressed()
Func _IsPressed()
    $arr = DllCall($dll, "int", "GetAsyncKeyState", "int", $talkhotkey )
    If Not @error And BitAND($arr[0], 0x8000) = 0x8000 Then Return 1
    Return 0
EndFunc   ;==>_IsPressed

; modified from _MouseClickPlus()
Func YahooMouseUpDown($downup)
    
  Local $button       =  0x0001
;~   Local $WM_LBUTTONDOWN   =  0x0201
;~   Local $WM_LBUTTONUP     =  0x0202
    Local $WM_MOUSEMOVE     =  0x0200
  
If $downup Then
    $ButtonUpDown = 0x0201
Else
    $ButtonUpDown = 0x0202
EndIf

; position of button
$xy = ControlGetPos ( $window, "", 201 )
;  test
;~ msgbox (0,'',$xy[0]&","& $xy[1]&","& $xy[2]&","& $xy[3]  )
; coords about in the middle of the button.
$xylong = _MakeLong( $xy[0]+25, $xy[1]+10 )
$handle = WinGetHandle( $window )

; may or may not be necessary.. it didn't help any..
ControlFocus ( $window, "", 201 )

; push button down or let up
DllCall($dll, "int", "SendMessage", _
  "hwnd", $handle, _
  "int", $WM_MOUSEMOVE, _
  "int", 0, _
  "long", $xylong )
DllCall($dll, "int", "SendMessage", _
  "hwnd", $handle, _
  "int", $ButtonUpDown, _
  "int", $Button, _
  "long", $xylong)
EndFunc

While 1
    If _IsPressed() Then
        If not $bdown Then
            $bdown = 1
            YahooMouseUpDown(1)
        EndIf
    ElseIf $bdown == 1 Then
        $bdown = 0
        YahooMouseUpDown(0)
    EndIf
    Sleep (100)
WEnd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...