Results 1 to 7 of 7
  1. #1
    Izochor's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    500
    Reputation
    33
    Thanks
    133
    My Mood
    Lurking

    Keyboard shortcuts in vb.net.

    Hey guys!

    I'm kinda noob at coding and trying to get a hang of it.
    I have a problem which I just can't solve right now. If I have anything that is interactive on my form hotkeys do not work for me. But if I delete all buttons, textboxes ect. it works. What am I doing wrong?

    My code:

     
    Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Try
    WriteMemory(Of Integer)(&H1444D0160, TextBox1.Text)
    Catch ex As Exception
    MessageBox.Show(ex.Message)
    End Try
    End Sub

    Private Sub Form1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If e.KeyCode = Keys.NumPad0 Then
    MessageBox.Show("wtf")
    End If
    End Sub
    End Class

  2. #2
    Lovroman's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Posts
    9,430
    Reputation
    611
    Thanks
    9,717
    My Mood
    Cheerful
    You might not have a full focus on the Form, that's why it doesn't detect keypress.

  3. #3
    Horror's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    51,4.
    Posts
    6,940
    Reputation
    574
    Thanks
    5,004
    My Mood
    Twisted
    A timer and GetAsyncKeyState works best (from my experience). I have never used KeyDown so I wouldn't know
     

    Minion+ : February 2014 - January 2015
    Counter Strike: Global Offensive Minion : November 2014 - January 2015
    Alliance of Valiant Arms Minion : August 2014 - January 2015
    Need For Speed World Minion : January 2014 - January 2015
    Rust Minion : January 2014 - January 2015
    Call of Duty Minion : January 2013 - January 2015
    Editor : December 2012 - April 2013
    Donator : March 2014 - Current
    Member : October 2010 - Current

    Previously known as "Isaakske".

  4. #4
    Izochor's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    500
    Reputation
    33
    Thanks
    133
    My Mood
    Lurking
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Int16

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    If (GetAsyncKeyState(Keys.F1)) Then
    WriteMemory(Of Integer)(&H1444D0160, 200)
    End If

    This did the trick thx @Horror! My next problem is how to trigger them when another window is active lol any tips?

  5. #5
    Horror's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    51,4.
    Posts
    6,940
    Reputation
    574
    Thanks
    5,004
    My Mood
    Twisted
    Quote Originally Posted by Izochor View Post
    My next problem is how to trigger them when another window is active lol any tips?
    Should work just fine even when active in just the background
    I used these hotkeys for games, so the game would be active, and the form would still recognize the buttons being pressed
     

    Minion+ : February 2014 - January 2015
    Counter Strike: Global Offensive Minion : November 2014 - January 2015
    Alliance of Valiant Arms Minion : August 2014 - January 2015
    Need For Speed World Minion : January 2014 - January 2015
    Rust Minion : January 2014 - January 2015
    Call of Duty Minion : January 2013 - January 2015
    Editor : December 2012 - April 2013
    Donator : March 2014 - Current
    Member : October 2010 - Current

    Previously known as "Isaakske".

  6. #6
    Izochor's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    500
    Reputation
    33
    Thanks
    133
    My Mood
    Lurking
    It works!

  7. #7
    Horror's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Location
    51,4.
    Posts
    6,940
    Reputation
    574
    Thanks
    5,004
    My Mood
    Twisted
    Solved & Closed then
     

    Minion+ : February 2014 - January 2015
    Counter Strike: Global Offensive Minion : November 2014 - January 2015
    Alliance of Valiant Arms Minion : August 2014 - January 2015
    Need For Speed World Minion : January 2014 - January 2015
    Rust Minion : January 2014 - January 2015
    Call of Duty Minion : January 2013 - January 2015
    Editor : December 2012 - April 2013
    Donator : March 2014 - Current
    Member : October 2010 - Current

    Previously known as "Isaakske".

  8. The Following User Says Thank You to Horror For This Useful Post:

    Izochor (01-24-2014)

Similar Threads

  1. [Discussion] no keyboard
    By RedThunder in forum Combat Arms Discussions
    Replies: 15
    Last Post: 09-22-2011, 09:58 PM
  2. Problem with alias shortcuts.
    By Kingofhyrule in forum Vindictus Discussions
    Replies: 4
    Last Post: 03-15-2011, 01:06 PM
  3. Adobe Photoshop Cs3 Shortcuts
    By wescooldude3 in forum Combat Arms Mod Tutorials
    Replies: 4
    Last Post: 10-08-2010, 04:10 AM
  4. [Help]Making shortcuts[Solved]
    By nathanael890 in forum Visual Basic Programming
    Replies: 9
    Last Post: 08-02-2010, 09:08 AM