Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In W9x can do simply this (API's not posted)
Const VK_SCROLL As Long = &H91 Dim keys(0 To 255) As Byte GetKeyboardState keys(0) keys(VK_SCROLL) = 1 SetKeyboardState keys(0) It seems in later versions need to do a bit more to switch the led, try this - http://support.microsoft.com/kb/177674 The example is aimed at VB(4/5/6) users, paste all incl Command1_Click into a normal module and run (and perhaps rename) "Command1_Click". Regards, Peter T "MicrosoftNews" wrote in message ... Hi, I want to switch the "scroll" led with vba on and of with different buttons ... I want to switch on and off the scroll led with the following code -------------------------------------------------------------------------- ----------- Private Declare Sub keybd_event Lib "user32" ( _ ByVal bVk As Byte, _ ByVal bScan As Byte, _ ByVal dwFlags As Long, _ ByVal dwExtraInfo As Long) Private Const VK_OEM_SCROLL = &H91 Private Const KEYEVENTF_KEYUP = &H2 Declare Function GetKeyState Lib "user32.dll" ( _ ByVal nVirtKey As Long) As Integer Sub SCROLL_aktiv() 'SCROLL-Lock aktivieren (falls deaktiviert) If Not (GetKeyState(vbKeyOEM_SCROLL) = 1) Then keybd_event VK_OEM_SCROLL, 1, 0, 0 keybd_event VK_OEM_SCROLL, 1, KEYEVENTF_KEYUP, 0 End If End Sub Sub SCROLL_inaktiv() ' SCROLL-Lock deaktivieren (falls aktiviert) If (GetKeyState(vbKeyOEM_SCROLL) = 1) Then keybd_event VK_OEM_SCROLL, 1, 0, 0 keybd_event VK_OEM_SCROLL, 1, KEYEVENTF_KEYUP, 0 End If End Sub -------------------------------------------------------------------------- -------------- with the scroll_aktiv procedure i can toggle between on and off. but it should only switch on the led. with scroll_inaktiv i can't switch of the led - and i don't know why the following procedure for the num lock led works fine -------------------------------------------------------------------------- ---- Private Declare Sub keybd_event Lib "user32" ( _ ByVal bVk As Byte, _ ByVal bScan As Byte, _ ByVal dwFlags As Long, _ ByVal dwExtraInfo As Long) Private Const VK_NUMLOCK = &H90 Private Const KEYEVENTF_KEYUP = &H2 Declare Function GetKeyState Lib "user32.dll" ( _ ByVal nVirtKey As Long) As Integer Sub NUM_TOGGLE() ' NUM-Lock drücken ' Zunächst niederdrücken und dann wieder loslassen keybd_event VK_NUMLOCK, 1, 0, 0 keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0 End Sub Sub NUM_aktiv() 'NUM-Lock aktivieren (falls deaktiviert) If Not (GetKeyState(vbKeyNumlock) = 1) Then keybd_event VK_NUMLOCK, 1, 0, 0 keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0 End If End Sub Sub NUM_inaktiv() ' NUM-Lock deaktivieren (falls aktiviert) If (GetKeyState(vbKeyNumlock) = 1) Then keybd_event VK_NUMLOCK, 1, 0, 0 keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0 End If End Sub -------------------------------------------------------------------------- ---------- thanks for any help .. achim |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Shortcut to switch from "fill down" to "copy" with mouse drag | Excel Discussion (Misc queries) | |||
Disabled "Switch Row/Column" when creating chart from a pivot tabl | Charts and Charting in Excel | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Why does excell switch my stock symbol "ACN" to "CAN"? | Setting up and Configuration of Excel | |||
Scroll Bar missing "Control" tab in "Format Properties" dialog box | Excel Discussion (Misc queries) |