Vb6 Problem ( crashing )

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SwInY
    New Member
    • Jun 2006
    • 1

    Vb6 Problem ( crashing )

    Hey.
    my 1st vb6 program
    I am trying to make a program
    when u click start.
    if u hold down space bar
    it sendkeys space
    But when i try making it it gets in a loop and kills it
    i want it to keep looping untill the stop button is pressed




    General declrations

    'Made By Dean Swinfield
    'Started on 9/6/06 Finished / /06
    'Bunny Hop Program
    Option Explicit
    Dim bunny As Integer

    'Sleep wait
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


    Module's
    Public Declare Function GetKeyState Lib "user32" _
    (ByVal nVirtKey As Long) As Integer
    Public Const KeyDown As Long = -128




    When u press start it does this

    Private Sub cmdRun_Click()
    ' Set bunny 2 1
    bunny = 1

    MsgBox "Program Started", vbOKOnly, "Started"
    Do While bunny <> 0
    If GetKeyState(vbK eySpace) And KeyDown Then
    SendKeys (vbKeySpace)
    End If
    Sleep 10000
    Loop


    MsgBox "Program Finished", vbOKOnly, "Finished"
    End Sub


    when u click stop it does this
    ' End turns bunny 2 0
    bunny = 0





    if any 1 can help me out with it it be great
    or finish the code thx
    Last edited by SwInY; Jun 12 '06, 03:07 PM.
Working...