Solved

Disable System Keys

Posted on 1998-04-29
2
492 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

623 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