Newsgroup: it.comp.lang.visual-basic
Titolo: Blocco di CTRL-ALT-CANC

 che non si termini
Esiste un controllo ocx che si chiama Disable che fa al caso tuo 
Il file zip si chiama disable.zip e lo trovi su Windows95.com o VolFtp
Spero di essere stato d'aiuto
Gaudenzio Martelli

Come faccio ad inibire i tasti CTRL-ALT-CANC da un programma ??? in modo
che non si termini
l'applicazione e non si spenga la macchina
Grazie ....
-- 
Berardi Paolo
Mail 
To:pber...@kjws.com

Eccoti la soluzione: Ti Posso Assicurare che Funziona alla grande
Ti Blocca CTRL+ALT+CANC e ALT+TAB e CTRL+ESC
How To Block CTRL+ALT+DEL and ALT+TAB in Windows 95 in VB
Article ID: Q154868
Creation Date: 15-AUG-1996
Revision Date: 20-JAN-1997
The information in this article applies to:
•Standard, Professional, and Enterprise Editions of Microsoft Visual Basic,
32-bit only, for Windows, version 4.0
SUMMARY
It is possible to prevent the CTRL+ALT+DEL and ALT+TAB key combinations
from bringing up the task list in Windows 95 by calling a function in the
Win32 API. This article demonstrates this procedure.
NOTE: This is possible only in Windows 95.
MORE INFORMATION
It may be necessary for a program to prevent users from pressing the
CTRL+ALT+DEL key combination to bring up the Close Program task list in
Windows 95 from where they can end a task or shut down the system.
This can be done using the SystemParametersInfo API. A sample program
demonstrating this is given below.
Note that disabling CTRL+ALT+DEL is not recommended because the Close
Program dialog was created to allow misbehaving applications to be
terminated. If a program "hangs" while CTRL+ALT+DEL is disabled, it may not
be possible to terminate it by any method other than a hardware reboot of
the machine, possibly resulting in loss of data. Also, this technique may
not work in future versions of Windows.
The technique involves tricking Windows 95 into thinking that a screen
saver is running. A side effect of this is that CTRL+ALT+DEL no longer has
any affect.
The Win32 SDK states:
   "SPI_SCREENSAVERRUNNING Windows 95: Used internally; applications should
   not use this flag. Windows NT: Not supported."
Step-by-Step Example
1.Start a new Visual Basic project. Form1 is created by default. 2.Add two
Command buttons to Form1. 3.Put the following code into the General
Declarations section of Form1:
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
Private Sub Command1_Click()
     Dim ret As Integer
     Dim pOld As Boolean
     ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)
End Sub
Private Sub Form_Load()
     Command1.Caption = "Disabled"
     Command2.Caption = "Enabled"
End Sub
Private Sub Command2_Click()
     Dim ret As Integer
     Dim pOld As Boolean
     ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
End Sub
Private Sub Form_Unload(Cancel As Integer) ' re-enable Ctrl+Alt+Del and
Alt+Tab before the program terminates
     Command2_Click
End Sub 4.Run the project and click the Disable button to test. Click the
Enable button to enable CTRL+ALT+DEL and ALT+TAB again.
REFERENCES
SystemParametersInfo is documented in the Win32 SDK available in the
MSDN/Visual Basic Starter Kit that can be installed from the CD-ROM version
of Visual Basic 4.0, Professional and Enterprise Editions. Install by
running SETUP.EXE in the MSDN directory on the CD-ROM. It is also available
in the MSDN Development Library that is available under subscription from
Microsoft.
------------------------------------------------------------------------
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS
IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES,
EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION
OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT,
INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL
DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION
OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE
FOREGOING LIMITATION MAY NOT APPLY.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.
KBCategory: kbusage kbenv kbhowto
KBSubcategory: APrgOther
Additional reference words: 4.00 vb4win vb432 reboot kbuk
