NextGen1, i was just trying to fix the hotkeys on my spammer over teamviewer with hejsan but he couldn't get them to work.. He said it was this code...
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
He said the problem is I am 64 bit...
He also said you might now how to fix it..
Returning short (16 bits, not 32)
[php]
<DllImport("user32.dll", CharSet:=CharSet.Auto, setLastError:=True)> _
Public Function GetAsyncKeyState(ByVal vKey As Integer) As Short
End Function
Public Function GetAsyncKeyState(ByVal vKey As Int32) As Int16
[/php]
please let us know if it works, many others may have this problem as well
Originally Posted by NextGen1
Returning short (16 bits, not 32)
[php]
<DllImport("user32.dll", CharSet:=CharSet.Auto, setLastError:=True)> _
Public Function GetAsyncKeyState(ByVal vKey As Integer) As Short
End Function
Public Function GetAsyncKeyState(ByVal vKey As Int32) As Int16
[/php]
please let us know if it works, many others may have this problem as well
Yes, it did work.. Thank you very much! I will give you and Hejsan credits..
Will this work for x32/x64 bit or for x64 bit only?
This will work for X86,X64.
But would it be necessary or productive, don't know
/marked solved
I have the same problem, I use all the correct codes and stuff but when I press a hotkey nothing happens. There's no errors or problems with bugs. I tried imputting your code NextGen1 but it said Type "DllImport' is not defined. Any help would be appreciated.
Sorry I'm relatively new to VB, do i place <DllImport> below Public Class Form1?
Namespaces are placed above public class form1.
Yes , it would be
Sample code for demonstration purposes
[php]
'namespace Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("user32.dll", CharSet:=CharSet.Auto, setLastError:=True)> _
Public Function GetAsyncKeyState(ByVal vKey As Integer) As Short
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' random
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'random
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'random
End Sub
Public Sub HotKey(ByVal hotkey As Boolean)
'random
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
'random
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEv entArgs) Handles WebBrowser1.DocumentCompleted
'random
End Sub
End Class
[/php]
The concept is similar to tags in web design
First I like to create notes so 'Comments after " ' "
First Your Imports
Then we will call the next your Form name Wrapper
[php]
Public Class Form1
'Random Information
'Random Information
'Random Information to happen in between Class
'Random Information
'Random Information
End Class
[/php]
In html, the concept is similar to tables
[php]
<table> = Public Class Form1
</table> = End Class
[/php]
I was going to go into great detail comparing <tr> and <td> and <div> to the elements of an application, But I am to lazy.
Okay at the moment my code looks like this (Making an AC to practice)
Code:
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("user32.dll", CharSet:=CharSet.Auto, setLastError:=True)> _
Public Function GetAsyncKeyState(ByVal vKey As Integer) As Short
End Function
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags _
As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons _
As Long, ByVal dwExtraInfo As Long)
Private Const MOUSELEFTDOWN = &H2 ' left button down
Private Const MOUSELEFTUP = &H4 ' left button up
++ more obviously but that's the start and I'm getting this error:
Code:
Error 1 'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to instance method.
EDIT: forgot to add that the "blue squiggly underlined" section is the "GetAsyncKeySet" from
Code:
Public Function GetAsyncKeyState(ByVal vKey As Integer) As Short
Okay I'm sorry to sound like a complete retard but what exactly are you trying to say?
[php]
Public Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
[/php]
So it should be this
[php]
Imports System.Runtime.InteropServices
Public Class Form1
Public Function GetAsyncKeyState(ByVal vKey As Integer) As Short
End Function
'Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags _
As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons _
As Long, ByVal dwExtraInfo As Long)
Private Const MOUSELEFTDOWN = &H2 ' left button down