This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-12-11 11:26:22

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

I need VB 2010 Help!

I'm just starting, (mainly by looking at other people's code) and have made an autoclicker. It's very simple, and easy to understand. but there's a major flaw. no hotkey to start/stop the code. DX I need to find out how to do that, so that F1 executes this code:

Code:

timer1.start

and F2 does

Code:

timer1.stop

If you could, add some comments to help me understand. Thanks!  smile
Edit: Here's the code. you need 1 timer, 3 buttons, and 1 label with the default text set to 0.

Code:

Public Class Form1
    Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Stop()
    End Sub
    Private Sub MyMethod()
        Windows.Forms.Cursor.Position = New System.Drawing.Point(Windows.Forms.Cursor.Position)
        mouse_event(&H2, 0, 0, 0, 1)
        mouse_event(&H4, 0, 0, 0, 1)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Label1.Text = Label1.Text + 1
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        MyMethod()
    End Sub

End Class

Last edited by 16Skittles (2010-12-11 11:27:40)


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#2 2010-12-14 21:44:29

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: I need VB 2010 Help!

http://www.vbforums.com/showthread.php?t=515051

This is gonna help.  smile


Hai.

Offline

 

#3 2010-12-15 02:39:51

ob6160
Scratcher
Registered: 2010-10-10
Posts: 500+

Re: I need VB 2010 Help!

It's easy  big_smile
Here is an example:

Code:

 Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.F2 Then
        timer1.stop 
        End If
    End Sub

I hope this helps  big_smile

OB6160


http://i45.tinypic.com/2jcygsy.gif

Offline

 

Board footer