• Log in or sign up for an account here: https://www.sythe.org/login

Keypresses....

  • Thread starter Thread starter RawrTo1
  • Start date Start date
R

RawrTo1

Guest
[VB6]

Okay, Basically i have created a program which works in just the same was a macro.

The application listens for a key to be pressed before it sends the text which is inside one of the text boxes on the form.

What i have been trying to do is make it so that the user can define their own button to press to send the macro

Currently it works if in the code if specify something like vbkeyF1 or vbKeyY or any vbKey code.


But when i try to put it in a variable it just gives me the run time error '13' blah blah....

I have tried using a CONST as a variable but they cannot be changed during run time and are fixed variables.


I Currently use "Private Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal KEY As Long) As Integer" to listen to global keypresses...


If there is an easier way of being able to listen to keypresses the way i want it please tell me :P


Thanks if anyone can help... :)
 
Give the user a dropdown list of all the keys available for the use of the shortcut.
Then on the "Click" or "Change" event of the dropdown button set your selected hotkey to a variable using the Asc() function.

The GetAsyncKeyState is also the recommended API.
You may also be interested in these:
http://allapi.mentalis.org/apilist/apilist.php
http://allapi.mentalis.org/apilist/GetAsyncKeyState.shtml
http://allapi.mentalis.org/apilist/RegisterHotKey.shtml
http://allapi.mentalis.org/apilist/UnregisterHotKey.shtml

I've uploaded a demo project for you to study.
 

Attachments

Runescape Gamblingrunescape gambling
Back
Top