+ Reply to Thread
Showing results 1 to 7 of 7

Thread: Visual Basics Help

  1. #1
    I hate Steve Jobs. Senior Member
    Gold Member

    Crusader
    lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of
    Join Date
    Jun 2005
    Location
    Fullerton, CA
    Posts
    3,247

    Default Visual Basics Help

    I am learning VB and I was trying to see if I can make a simple message spoofer using the "SendKey" functions.

    Code:
    Dim wName As Long
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    
    Private Sub Timer1_Timer()
    KeyResult = GetAsyncKeyState(vbKeyHome)
       If KeyResult = -32767 Then
    
    SendKeys "Hello, world."
    
    
    End If
    End Sub

    When I go into a game and press home, it doesnt work. I think something's wrong with the timer or I'm just doing something wrong.

    Also these guys suggested

    the timer interval thing isnt in the code, on the IMAGE thing, where you can see how the build of it, like where you see the timers buttons and stuff, there is where you should click the timer, and set the interval to 1.

    and

    Hmm, You should also set your timers time or whatever. I think default is 0 so brining it to 1 will make it so you can do this every 1/1000 of a second. Putting this at 1000 will refresh the button every second, you get the idea. Well go and fix that part, and it should work.
    What in the world does that mean? Help would be greatly appreciated and the fixed version of the code would be even better.

    -Thanks

  2. #2
    Senior Member

    Heretic

    Crusader
    Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac's Avatar
    Join Date
    Jun 2005
    Location
    Jacksonville, FL, USA
    Posts
    3,413

    Default

    Set the Timer's interval to 1000 in it's properties. Timers by default initialize with an interval of 0 milliseconds, and so they are inactive.

    Oh, and it's Visual Basic, not Visual Basics. Basic is an acronym for Beginner's-All-purpose-Symbolic-Instruction-Code.
    The Ultimate Guide Thread
    Quote Originally Posted by Ethernet Networking Bible
    Thou shalt switch where thy can, and route where thy must.

  3. #3
    I hate Steve Jobs. Senior Member
    Gold Member

    Crusader
    lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of
    Join Date
    Jun 2005
    Location
    Fullerton, CA
    Posts
    3,247

    Default

    Thanks, it worked.

    Also, is there any way I can delay a new message? For instance If i press delete the message "virus download 1%" and then delay for about another second then "virus download 3%" etc. ?

  4. #4
    Jackhammer Jesus Retired Staff Member

    Disciple
    indulgence is just really nice indulgence is just really nice indulgence's Avatar
    Join Date
    Jan 1970
    Posts
    521

    Default

    It would be infinitely nicer if you used SendMessage. Otherwise, you can't be certain as to which window is getting the keyboard event. Even if you setfocus of window x - the user can change it as they would focus on any window.

  5. #5

    Deviant
    Mr_Mooo_Cow is on a distinguished road
    Join Date
    Mar 2005
    Location
    Marlton, NJ
    Posts
    90

    Default

    Quote Originally Posted by lpxxfaintxx
    Thanks, it worked.

    Also, is there any way I can delay a new message? For instance If i press delete the message "virus download 1%" and then delay for about another second then "virus download 3%" etc. ?
    Welfare = Use Sleep API
    Maybe more welfare? = make a function or whatnot with tickrate API or w/e that api is lol! sorry for crappy reply
    Bahhh sheep!

  6. #6
    Senior Member

    Heretic

    Crusader
    Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac has a reputation beyond repute Dyndrilliac's Avatar
    Join Date
    Jun 2005
    Location
    Jacksonville, FL, USA
    Posts
    3,413

    Default

    The most simplistic way to go about doing this is to make a pause function. Try this:
    Code:
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    
    Public Sub Pause(intDelay As Integer)
    'Note: "intDelay" is the amount of time to be delayed in _seconds_!
        Dim msDelay As Integer, i As Integer, x As Integer
        
        msDelay = intDelay * 1000
        x = msDelay / 100
        For i = 1 To x
            Sleep (100)
            DoEvents
        Next
    End Sub
    The above code is UNTESTED, but it SHOULD work with little or no alterations. The function causes the program to pause for a tenth of a second, and then do all the events that got backlogged in the queue and repeat this process until the delay time has been met.

    For example, if you used the following pseudocode:
    Code:
    SendBWMessage("Hi! My name is Fred!")
    Pause(10)
    SendBWMessage("What's yours?")
    The program would wait ten seconds before displaying the second message, however if the program recieved a queued event (Such as a request by the system to change it's Window Caption) it would process that event during the pause, whereas if you just used Sleep() without this setup the queue would be processed after Sleep() finished.

    I hope I explained that clearly :wall:.
    The Ultimate Guide Thread
    Quote Originally Posted by Ethernet Networking Bible
    Thou shalt switch where thy can, and route where thy must.

  7. #7
    I hate Steve Jobs. Senior Member
    Gold Member

    Crusader
    lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of lpxxfaintxx has much to be proud of
    Join Date
    Jun 2005
    Location
    Fullerton, CA
    Posts
    3,247

    Default

    Quote Originally Posted by Dyndrilliac
    The most simplistic way to go about doing this is to make a pause function. Try this:
    Code:
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    
    Public Sub Pause(intDelay As Integer)
    'Note: "intDelay" is the amount of time to be delayed in _seconds_!
        Dim msDelay As Integer, i As Integer, x As Integer
        
        msDelay = intDelay * 1000
        x = msDelay / 100
        For i = 1 To x
            Sleep (100)
            DoEvents
        Next
    End Sub
    The above code is UNTESTED, but it SHOULD work with little or no alterations. The function causes the program to pause for a tenth of a second, and then do all the events that got backlogged in the queue and repeat this process until the delay time has been met.

    For example, if you used the following pseudocode:
    Code:
    SendBWMessage("Hi! My name is Fred!")
    Pause(10)
    SendBWMessage("What's yours?")
    The program would wait ten seconds before displaying the second message, however if the program recieved a queued event (Such as a request by the system to change it's Window Caption) it would process that event during the pause, whereas if you just used Sleep() without this setup the queue would be processed after Sleep() finished.

    I hope I explained that clearly :wall:.

    Thanks man, it worked perfectly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Visual Basic 6.0
    By XGhozt in forum Software Development
    Replies: 23
    Last Post: 09-03-2005, 12:47 AM
  2. Visual Basics
    By XxSchoo_YouxX in forum Starcraft/Brood War
    Replies: 4
    Last Post: 07-09-2005, 05:30 AM
  3. Visual Basic
    By Trans_Am77 in forum Software Development
    Replies: 5
    Last Post: 02-16-2005, 11:54 PM
  4. Making Hacks In Visual Basics?
    By Iscariot in forum Starcraft/Brood War
    Replies: 16
    Last Post: 12-31-2004, 03:59 AM

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts