Numlock Key

  • Thread starter Thread starter Stan Sainte-Rose
  • Start date Start date
S

Stan Sainte-Rose

Hi

I saw a post about numlock but I can't not read it.

I would like to check the state of the numlock key
and if it's not active, set its status on active.
How can I accomplish that in vb ?

Stan
 
Hi,

API Declare
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Integer) As
Integer

Const VK_CONTROL = 11

Const VK_NUMLOCK = 144

Const VK_CAPLOCK = 20



How to use

Dim strNum As String

If GetKeyState(VK_NUMLOCK) Then

strNum = "Num"

Else

strNum = ""

End If



Ken
 
* "Ken Tucker said:
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Integer) As
Integer

Doesn't 'GetKeyState' return a 'Short' ('Int16')?
 
Hi

I thank you for your reply.. :-)
and how can I force the numlock ?
Something like SetKeyState ?

Stan



Ken Tucker said:
Hi,


Yes it is a short. My bad.

Ken
 
Back
Top