Program to focus mouse on location and write - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Program to focus mouse on location and write

benvrbenvr Posts: 1Member
Hi, so i am a newb in programming. i Am using Visual Basic 2010 express on Windows 7 64 bit. And i want to make a program.

What the program needs to do is.

When F1 is pushed save mouselocation.
When F2 is Pushed go to previous mouselocation and write the selected item from the combobox at the form.

my hotkeys aren't working and i'm getting a strange error: Pinvokestackim...

This is my code for now. Feel free to add/edit something. I realy need help with. Getting hotkey to work. Then my mouse needs to click. And then he needs to write the selected item. (code is only for the hotkeys atm)


Public Class frmLaneCaller
Declare Function SetCursorPos Lib "user32.dll" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Short

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim sngPunt1 As Point, sngPunt2 As Point
Dim hotkey As Boolean, hotkey2 As Boolean
'hotkeys (little declaration)
hotkey = GetAsyncKeyState(Keys.F1)
hotkey2 = GetAsyncKeyState(Keys.F2)
'previous points of mouse
sngPunt1.X = MousePosition.X
sngPunt2.Y = MousePosition.Y

End Sub
End Class
Sign In or Register to comment.