View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default StickyKeys Status

I don't work a lot w/API calls, but pieced this together from these sites:
http://math.msu.su/~vfnik/WinApi/s/s...etersinfo.html
http://www.section508.gov/IRSCourse/mod02/printVB.html

It appears to work, but you'll want to check it out for yourself:

Option Explicit
Public Const SPI_GETSTICKYKEYS = 58
Public Const SKF_STICKYKEYSON = &H1

Public Type STICKYKEYS
cbSize As Long
dwFlags As Long
End Type

Public Declare Function SystemParametersInfo Lib "user32.dll" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, _
ByVal uiParam As Long, pvParam As Any, ByVal fWinIni As Long) _
As Long


Sub test()
Dim sk As STICKYKEYS ' holds settings for StickyKeys
Dim retval As Long ' return value

sk.cbSize = Len(sk) ' set the size of the structure
' Load the StickyKeys settings into the structure.
retval = SystemParametersInfo(SPI_GETSTICKYKEYS, Len(sk), sk, 0)
' don't need to notify
' Assign StickyKeys setting as on or off.
If (sk.dwFlags And SKF_STICKYKEYSON) = SKF_STICKYKEYSON Then
MsgBox "Stickykeys is on"
Else
MsgBox "Stickykeys is off"
End If

End Sub


"Gary''s Student" wrote:

Is there a method or API that I can use in VBA to determine the StickyKeys
status?
Where it is off or on?
--
Gary''s Student - gsnu200729