Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Disable System Keys

Posted on 1998-04-29
2
Medium Priority
?
495 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 400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month12 days, 16 hours left to enroll

971 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