Mark said:
I'm trying to send the command to a KVM switch. If you double press
"Scroll
Lock" it changes you to another computer screen. I'm trying to do this
from
with in a program. The sendkeys is what I need, but I'm still looking for
the code the Scroll Lock button produces.
1. Create a form and place a command button on it, called Command0
2. Paste the following code into the form's class module
3. Open the form and click the button
4. If it works (ie you switch ok) then fine. If not, play with the sleep
command till it works <g>
''' BEGIN CODE '''
Private Declare Sub keybd_event Lib "user32.dll" _
(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
Const VK_SCROLL = &H91
Const KEYEVENTF_KEYUP = &H2
Private Sub Command0_Click()
keybd_event VK_SCROLL, 0, 0, 0 'Press Scroll Lock
keybd_event VK_SCROLL, 0, KEYEVENTF_KEYUP, 0 'Release Scroll Lock
Sleep 100 'Wait a bit
keybd_event VK_SCROLL, 0, 0, 0 'Press Scroll Lock
keybd_event VK_SCROLL, 0, KEYEVENTF_KEYUP, 0 'Release Scroll Lock
End Sub
''' END CODE '''