Solved

Disable System Keys

Posted on 1998-04-29
2
487 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

929 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

15 Experts available now in Live!

Get 1:1 Help Now