Solved

kill sticky keys window in VB

Posted on 2004-08-24
6
634 Views
Last Modified: 2011-10-03
hows it

I need to find away to either disable sticky keys only while my program is running, or kill the process before it has a chance to pop up on top. At this stage I would even settle for hiding the window.
I have been searching for a couple of days and so far all I have come up with is to disable it in the registry, which requires a reboot or possibly a log off for it to take effect, so that’s no good.
The program is written in VB 6 and will be running on xp (maybe 2k if it works sweet).

Any help will be much appreciated

Cheers
geno
0
Comment
Question by:G3NOCIDE
  • 3
6 Comments
 
LVL 2

Expert Comment

by:Discofish
ID: 11884483
You'll need to set a key in the registry.

HKEY_CURRENT_USER\Control Panel\Accessibility\StickeyKeys\Flags

Set it to 506.  You might have to restart the computer, not sure on this one. You'll need the win32 API registry functions to do this. There should be a text file somewhere in the Visual Studio installation that details the API fucntions (VPAPI.txt or something like that).  I think the following will do it for you.  Check the msdn for explanations.

Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" ( _
    ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, _
    ByVal samDesired As Long, ByRef phkResult As Long) As Long


Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" ( _
    ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
    ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As Long


Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
    ' Note that if you declare the lpData pa
    '     rameter as String in RegSetValueEx, you
    '     must pass it ByVal.


Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
    ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _
    ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long


Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" ( _
    ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long


Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" ( _
    ByVal hKey As Long, ByVal lpValueName As String) As Long


Private Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" ( _
    ByVal hKey As Long, ByVal lpSubKey As String) As Long


0
 
LVL 2

Expert Comment

by:Discofish
ID: 11884511
0
 

Author Comment

by:G3NOCIDE
ID: 11888504
i have already tried doing it in the registry, and the effects dont happen until a reboot or login. which is no good because i need sticky keys to disable only when my program is running. I cant expect the user to reboot all the time so they can use sticky keys if the have to.

cheers
geno  
0
 
LVL 2

Accepted Solution

by:
Discofish earned 250 total points
ID: 11904027

I noticed that if you change the setting for stickey keys from the control panel  Accessibility Options [keyboard tab] [stickyKeys box] -> settings button that will disable it right away.  If you could figure out what API calls you need to acomplish this, you'd be set.

Discofish
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
drawing animated level bar based on numbers 3 97
java  and programming certification ? 4 93
Currency Conversion? 1 86
program a usb light to turn on when needed 7 63
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question