Solved

Disable System Keys

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

738 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