Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 31st, 2005, 4:17 PM   #1
Thray
Newbie
 
Join Date: Jul 2005
Posts: 2
Rep Power: 0 Thray is on a distinguished road
Help with autoclicker...

I really want to program an autoclicker for myself. the part i need is how to get the program to actually "click"...but i dont know how to go about coding that...could anyone help me out?
Thray is offline   Reply With Quote
Old Aug 1st, 2005, 1:47 PM   #2
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
The simplest way is the mouse_event win32 routine, as far as I can tell it emulates at hardware level.
Put this in a module and set startup to sub main. It'll click 50 times each second, so keep the cursor away from that self destruct button
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As MouseEventFlags, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Enum MouseEventFlags
    MOUSEEVENTF_LEFTDOWN = &H2
    MOUSEEVENTF_LEFTUP = &H4
    MOUSEEVENTF_MIDDLEDOWN = &H20
    MOUSEEVENTF_MIDDLEUP = &H40
    MOUSEEVENTF_MOVE = &H1
    MOUSEEVENTF_ABSOLUTE = &H8000
    MOUSEEVENTF_RIGHTDOWN = &H8
    MOUSEEVENTF_RIGHTUP = &H10
End Enum
Public Sub Main()
    For Clickeeeee = 1 To 50
        Dim mouseButtons As Long ' Pointer to mouse button struct - unused
        Dim dwEI As Long ' Pointer to Extra Info struct - unused
        
        ' N.B. A mouse "click" is Down then Up
        mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, mouseButtons, dwEI
        NoFreezeSleep 1
    Next
End Sub
Private Sub NoFreezeSleep(ByVal NumSecs As Long)
    Dim EntryTime As Long
    EntryTime = Timer
    Do
        DoEvents
    Loop While (Timer - EntryTime) < NumSecs
End Sub
Rory is offline   Reply With Quote
Old Aug 8th, 2005, 1:41 AM   #3
Thray
Newbie
 
Join Date: Jul 2005
Posts: 2
Rep Power: 0 Thray is on a distinguished road
wow...thanks
Thray is offline   Reply With Quote
Old Aug 11th, 2005, 1:45 PM   #4
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
No probs! For an RPG stat roller or something?
Rory is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:50 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC