You can use an API, or use an ocx called KEYSTA32 which was shipped with VS VB6.
You will find it under:
\Microsoft Visual Studio\Common\Tools\CONTROLS\KEYSTA32.ocx
Set a reference to this (PROJECT|COMPONENTS). It will not be listed in the components list, so you need to click the search button.
Once added to the project, add the control to a form and set it's visible property to false.
In code you can check the key states like:
Dim bCapsLockOn As Boolean
Dim bNumLockOn As Boolean
Dim bScrollLockOn As Boolean
Me.MhState1.Style = keyCapsLock
bCapsLockOn = Me.MhState1.Value
Me.MhState1.Style = keyNumLock
bNumLockOn = Me.MhState1.Value
Me.MhState1.Style = keyScrollLock
bScrollLockOn = Me.MhState1.Value