![]() |
StickyKeys Status
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 |
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 |
StickyKeys Status
Thanks !!
Great job on the research as well ! -- Gary''s Student - gsnu200729 "JMB" wrote: 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 |
StickyKeys Status
you're most welcome!
"Gary''s Student" wrote: Thanks !! Great job on the research as well ! -- Gary''s Student - gsnu200729 "JMB" wrote: 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 |
StickyKeys Status
although, for my part, it was all a copy/paste operation. but, as my
coworker used to say, "plagiarism cuts overhead." "Gary''s Student" wrote: Thanks !! Great job on the research as well ! -- Gary''s Student - gsnu200729 "JMB" wrote: 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 |
All times are GMT +1. The time now is 11:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com