Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


Setting hotkey of textbox filter_list
Author
Message
RE: Setting hotkey of textbox #7
(03-20-2013, 01:22 AM)RA1N Wrote: orrrrr....
Code:
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Short
Code:
Public Function GetKeyState(ByVal key As Integer) As Boolean
        Dim s As Short
        s = GetAsyncKeyState(key)
        If s = 0 Then Return False
        Return True
    End Function
Code:
If GetKeyState(Keys.*) = True Then
'put this if statement in a thread to run through to keep a check on it.
End If

This way it checks through out the whole time while running the program for a hotkey.

Perhaps, but you have to call it multiple times to make sure that it hits the time a user presses a key because it's not based on events. He wanted a hotkey for specifically a textbox as I read it. If you wanted a global system-wide hotkey, you could do it this way, but it is a very poor way, and it uses a lot of resources because it has to be called constantly.

There's much better ways, even avoiding this, and a keyboard hook, but a keyboard hook is the ultimate way in my opinion, because you don't have to register and unregister a specific hotkey that may already be taken by something else.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply





Messages In This Thread
Setting hotkey of textbox - by absde20 - 03-17-2013, 10:47 PM



Users browsing this thread: 3 Guest(s)