Keyboard problem 
Author Message
 Keyboard problem

Hello
1:You could intercept the key you want using DirectInput.The codes for the Windows key are: DIK_RWIN and DIK_LWIN. How does the prog
ram crash??Are you using DirectInput or a X_keyup,keydown,keypress event??
2:I didn't test the code below on a XP machine but it should work

'-----START PASTE-----
Const Caps_Lock = &H14
Const Scroll_Lock = &H91
Const Numl_Lock = &H90
Private Type UDT
     kbByte(0 To 255) As Byte
End Type
Private Declare Function GetKeyboardState Lib "user32" (kbArray As UDT) As Long
Private Declare Function SetKeyboardState Lib "user32" (kbArray As UDT) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim kbArray As UDT
Private Sub Form_Load()
    MsgBox "Press OK to start."
    OFF Caps_Lock
    OFF Numl_Lock
    OFF Scroll_Lock
    Sleep 1000
    ONS Numl_Lock
    ONS Scroll_Lock
    Sleep 200
    OFF Numl_Lock
    OFF Scroll_Lock
    Sleep 200
    ONS Caps_Lock
    Sleep 200
    OFF Caps_Lock
    Sleep 200
    ONS Caps_Lock
    Sleep 200
    OFF Caps_Lock
    Sleep 200
    ONS Numl_Lock
    ONS Scroll_Lock
    Sleep 200
    OFF Numl_Lock
    OFF Scroll_Lock
    Sleep 200
    ONS Numl_Lock
    ONS Scroll_Lock
    Sleep 200
    OFF Numl_Lock
    OFF Scroll_Lock
    Sleep 200
    ONS Caps_Lock
    Sleep 400
    OFF Caps_Lock
    Sleep 200
    ONS Numl_Lock
    Sleep 100
    ONS Caps_Lock
    Sleep 100
    ONS Scroll_Lock
    Sleep 300
    OFF Scroll_Lock
    Sleep 100
    OFF Caps_Lock
    Sleep 100
    OFF Numl_Lock
    Sleep 1000
    MsgBox "Press OK to end."
    Unload Me
End Sub
Private Sub ONS(Key As Long)
    GetKeyboardState kbArray
    kbArray.kbByte(Key) = 1
    SetKeyboardState kbArray
End Sub
Private Sub OFF(Key As Long)
    GetKeyboardState kbArray
    kbArray.kbByte(Key) = 0
    SetKeyboardState kbArray
End Sub

'-----END PASTE------

--
With best regards
Trimbitas Sorin
--
http://www.*-*-*.com/
--
| Hi,
| I want to disable some keyboard keys, cause when my program runs in
| fullscreen and I press the "WIN" key it crashes!
| Any help
|
| Also, I tried in WinXP to change the CAPS,NUM and SCR LOCK leds by API code
| and I failed, any suggestion?
| Thank you
| TED
|
|



Thu, 15 Dec 2005 04:01:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. keyboard problem

2. strange keyboard problem...

3. Keyboard problem

4. SendKeys causing keyboard problems

5. Keyboard problem...

6. 2 Keyboard problems!

7. 2 Keyboard problems!

8. Keyboard Problem

9. form-level keyboard handler problem (set problem = me?)

10. Macro keyboard shortcut problem

11. Keyboard logging program problem

12. problems with alternate keyboard use

 

 
Powered by phpBB® Forum Software