Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18013
Number of posts: 55386

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Program to focus mouse on location and write Posted by benvr on 5 Nov 2012 at 10:14 AM
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)


CODE:

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
'declaration
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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.