Solved

Disable System Keys

Posted on 1998-04-29
2
486 Views
Last Modified: 2008-02-26
I am currently working on a sercuity program but need to find out how to disable the system keys (Ctrl, Alt, Tab, Esc, and so on).  I could do with the code to do this.  Thanks.
0
Comment
Question by:peat042998
2 Comments
 
LVL 4

Accepted Solution

by:
zsi earned 100 total points
ID: 1434366
In VB, the easiest way to disable the system keys is by making Windows think that the screensaver is running.  The code below shows how to do this.  This only works under Windows 95, however, and not NT.  If this is a requirement, then you will have to subclass the Windows keyboard messages and intercept and discard references to the system keys.  If you are not using VB5, or you do not want to get into callback methods, then you will need a control such as MessageBlaster or Desaware's SpyWorks.

But, if you only need this for Win95, then here ya go.

zsi
======================================
Private Declare Function SystemParametersInfo Lib "user32" _
          Alias "SystemParametersInfoA" (ByVal uAction As Long, _
          ByVal uParam As Long, lpvParam As Any, _
          ByVal fuWinIni As Long) As Long
Private Const SPI_SCREENSAVERRUNNING = 97

To disable the keys:
     SystemParametersInfo SPI_SCREENSAVERRUNNING, True, ByVal 1&, 0

To enable them back again:
     SystemParametersInfo SPI_SCREENSAVERRUNNING, False, ByVal 1&, 0

Don't forget to re-enable the keys when your application exits, too.



0
 

Author Comment

by:peat042998
ID: 1434367
Thanks that did the job perfectly....:)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now