PC Review


Reply
Thread Tools Rate Thread

Disallow CTRL+ALT+DEL

 
 
=?Utf-8?B?anV0bGF1eA==?=
Guest
Posts: n/a
 
      16th Nov 2006
I have a excel workbook that is via VBA goes out to various 3rd party
applications and gets data from them. The problem I have is that this is not
instantaneous and even tough I have a progress bar showing things moving
along the user will hit CTRL+ALT+DEL and end the task. This is not a problem
for excel, but the other software applications seem to be getting "hung up"
b/c the data transfer is not complete. Is there a way when this workbook is
opened to disable the CTRL+ALT+DEL function?

I have tried using:
Application.OnKey "^%{DEL}", "NotAllowed"
but nothing happens.

I have even tried just looking for the CTRL + ALT
Application.OnKey "^%", "NotAllowed"
but with this I get run-time error 1004

and if I change it to
Application.OnKey "^{%}", "NotAllowed"
or
Application.OnKey "%{^}", "NotAllowed"
nothing happens

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmlsbCBQZmlzdGVy?=
Guest
Posts: n/a
 
      16th Nov 2006
http://www.planet-source-code.com/vb...=1494&lngWId=1


"jutlaux" wrote:

> I have a excel workbook that is via VBA goes out to various 3rd party
> applications and gets data from them. The problem I have is that this is not
> instantaneous and even tough I have a progress bar showing things moving
> along the user will hit CTRL+ALT+DEL and end the task. This is not a problem
> for excel, but the other software applications seem to be getting "hung up"
> b/c the data transfer is not complete. Is there a way when this workbook is
> opened to disable the CTRL+ALT+DEL function?
>
> I have tried using:
> Application.OnKey "^%{DEL}", "NotAllowed"
> but nothing happens.
>
> I have even tried just looking for the CTRL + ALT
> Application.OnKey "^%", "NotAllowed"
> but with this I get run-time error 1004
>
> and if I change it to
> Application.OnKey "^{%}", "NotAllowed"
> or
> Application.OnKey "%{^}", "NotAllowed"
> nothing happens
>

 
Reply With Quote
 
=?Utf-8?B?anV0bGF1eA==?=
Guest
Posts: n/a
 
      16th Nov 2006
I copied the code, but when the message box comes up saying "CTRL+ALT+DEL is
disabled, try pressing CTRL+ALT+DEL now." I press it and it still works. I
have tried running just the Disable_Ctrl_Alt_Del program below and still
can't get it to work.

Public Sub Disable_Ctrl_Alt_Del()
'Disables the Crtl+Alt+Del
Dim AyW As Integer
Dim TurFls As Boolean
AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, TurFls, 0)
End Sub

"Bill Pfister" wrote:

> http://www.planet-source-code.com/vb...=1494&lngWId=1
>
>
> "jutlaux" wrote:
>
> > I have a excel workbook that is via VBA goes out to various 3rd party
> > applications and gets data from them. The problem I have is that this is not
> > instantaneous and even tough I have a progress bar showing things moving
> > along the user will hit CTRL+ALT+DEL and end the task. This is not a problem
> > for excel, but the other software applications seem to be getting "hung up"
> > b/c the data transfer is not complete. Is there a way when this workbook is
> > opened to disable the CTRL+ALT+DEL function?
> >
> > I have tried using:
> > Application.OnKey "^%{DEL}", "NotAllowed"
> > but nothing happens.
> >
> > I have even tried just looking for the CTRL + ALT
> > Application.OnKey "^%", "NotAllowed"
> > but with this I get run-time error 1004
> >
> > and if I change it to
> > Application.OnKey "^{%}", "NotAllowed"
> > or
> > Application.OnKey "%{^}", "NotAllowed"
> > nothing happens
> >

 
Reply With Quote
 
=?Utf-8?B?QmlsbCBQZmlzdGVy?=
Guest
Posts: n/a
 
      16th Nov 2006
Here's a decent article that describes a couple methods:
http://msdn.microsoft.com/msdnmag/is...A/default.aspx

If you're just looking to stop people from accessing the Task Manager
through Ctrl-Alt-Del, use this registry setting (you can use vb/vba code to
set the Reg Key):

[HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableTaskMgr"=dword:00000001



"jutlaux" wrote:

> I copied the code, but when the message box comes up saying "CTRL+ALT+DEL is
> disabled, try pressing CTRL+ALT+DEL now." I press it and it still works. I
> have tried running just the Disable_Ctrl_Alt_Del program below and still
> can't get it to work.
>
> Public Sub Disable_Ctrl_Alt_Del()
> 'Disables the Crtl+Alt+Del
> Dim AyW As Integer
> Dim TurFls As Boolean
> AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, TurFls, 0)
> End Sub
>
> "Bill Pfister" wrote:
>
> > http://www.planet-source-code.com/vb...=1494&lngWId=1
> >
> >
> > "jutlaux" wrote:
> >
> > > I have a excel workbook that is via VBA goes out to various 3rd party
> > > applications and gets data from them. The problem I have is that this is not
> > > instantaneous and even tough I have a progress bar showing things moving
> > > along the user will hit CTRL+ALT+DEL and end the task. This is not a problem
> > > for excel, but the other software applications seem to be getting "hung up"
> > > b/c the data transfer is not complete. Is there a way when this workbook is
> > > opened to disable the CTRL+ALT+DEL function?
> > >
> > > I have tried using:
> > > Application.OnKey "^%{DEL}", "NotAllowed"
> > > but nothing happens.
> > >
> > > I have even tried just looking for the CTRL + ALT
> > > Application.OnKey "^%", "NotAllowed"
> > > but with this I get run-time error 1004
> > >
> > > and if I change it to
> > > Application.OnKey "^{%}", "NotAllowed"
> > > or
> > > Application.OnKey "%{^}", "NotAllowed"
> > > nothing happens
> > >

 
Reply With Quote
 
=?Utf-8?B?QmlsbCBQZmlzdGVy?=
Guest
Posts: n/a
 
      16th Nov 2006
Sorry, I was being lazy - here's the code:

Option Explicit

Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_CURRENT_USER = &H80000001


Public Sub ToggleCAD()
Dim lngUser As Long
Dim blnDisableTaskMgr As Boolean
Dim oReg As Object
Dim strKeyPath As String
Dim strValueName As String
Dim dwValue As Long

blnDisableTaskMgr = True
blnDisableTaskMgr = False


lngUser = HKEY_LOCAL_MACHINE
lngUser = HKEY_CURRENT_USER

Set oReg =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Policies\System\"
strValueName = "DisableTaskMgr"

oReg.DeleteValue lngUser, strKeyPath, strValueName

dwValue = IIf(blnDisableTaskMgr, 1, 0)
oReg.SetDWORDValue lngUser, strKeyPath, strValueName, dwValue


End Sub



"jutlaux" wrote:

> I copied the code, but when the message box comes up saying "CTRL+ALT+DEL is
> disabled, try pressing CTRL+ALT+DEL now." I press it and it still works. I
> have tried running just the Disable_Ctrl_Alt_Del program below and still
> can't get it to work.
>
> Public Sub Disable_Ctrl_Alt_Del()
> 'Disables the Crtl+Alt+Del
> Dim AyW As Integer
> Dim TurFls As Boolean
> AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, TurFls, 0)
> End Sub
>
> "Bill Pfister" wrote:
>
> > http://www.planet-source-code.com/vb...=1494&lngWId=1
> >
> >
> > "jutlaux" wrote:
> >
> > > I have a excel workbook that is via VBA goes out to various 3rd party
> > > applications and gets data from them. The problem I have is that this is not
> > > instantaneous and even tough I have a progress bar showing things moving
> > > along the user will hit CTRL+ALT+DEL and end the task. This is not a problem
> > > for excel, but the other software applications seem to be getting "hung up"
> > > b/c the data transfer is not complete. Is there a way when this workbook is
> > > opened to disable the CTRL+ALT+DEL function?
> > >
> > > I have tried using:
> > > Application.OnKey "^%{DEL}", "NotAllowed"
> > > but nothing happens.
> > >
> > > I have even tried just looking for the CTRL + ALT
> > > Application.OnKey "^%", "NotAllowed"
> > > but with this I get run-time error 1004
> > >
> > > and if I change it to
> > > Application.OnKey "^{%}", "NotAllowed"
> > > or
> > > Application.OnKey "%{^}", "NotAllowed"
> > > nothing happens
> > >

 
Reply With Quote
 
=?Utf-8?B?anV0bGF1eA==?=
Guest
Posts: n/a
 
      16th Nov 2006
If I do this on workbook open I would like to reenable CTRL+ALT+DEL on close.
To do this would I just change the follwoing?

strValueName = "EnableTaskMgr"


"Bill Pfister" wrote:

> Sorry, I was being lazy - here's the code:
>
> Option Explicit
>
> Const HKEY_LOCAL_MACHINE = &H80000002
> Const HKEY_CURRENT_USER = &H80000001
>
>
> Public Sub ToggleCAD()
> Dim lngUser As Long
> Dim blnDisableTaskMgr As Boolean
> Dim oReg As Object
> Dim strKeyPath As String
> Dim strValueName As String
> Dim dwValue As Long
>
> blnDisableTaskMgr = True
> blnDisableTaskMgr = False
>
>
> lngUser = HKEY_LOCAL_MACHINE
> lngUser = HKEY_CURRENT_USER
>
> Set oReg =
> GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
> strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Policies\System\"
> strValueName = "DisableTaskMgr"
>
> oReg.DeleteValue lngUser, strKeyPath, strValueName
>
> dwValue = IIf(blnDisableTaskMgr, 1, 0)
> oReg.SetDWORDValue lngUser, strKeyPath, strValueName, dwValue
>
>
> End Sub
>
>
>
> "jutlaux" wrote:
>
> > I copied the code, but when the message box comes up saying "CTRL+ALT+DEL is
> > disabled, try pressing CTRL+ALT+DEL now." I press it and it still works. I
> > have tried running just the Disable_Ctrl_Alt_Del program below and still
> > can't get it to work.
> >
> > Public Sub Disable_Ctrl_Alt_Del()
> > 'Disables the Crtl+Alt+Del
> > Dim AyW As Integer
> > Dim TurFls As Boolean
> > AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, TurFls, 0)
> > End Sub
> >
> > "Bill Pfister" wrote:
> >
> > > http://www.planet-source-code.com/vb...=1494&lngWId=1
> > >
> > >
> > > "jutlaux" wrote:
> > >
> > > > I have a excel workbook that is via VBA goes out to various 3rd party
> > > > applications and gets data from them. The problem I have is that this is not
> > > > instantaneous and even tough I have a progress bar showing things moving
> > > > along the user will hit CTRL+ALT+DEL and end the task. This is not a problem
> > > > for excel, but the other software applications seem to be getting "hung up"
> > > > b/c the data transfer is not complete. Is there a way when this workbook is
> > > > opened to disable the CTRL+ALT+DEL function?
> > > >
> > > > I have tried using:
> > > > Application.OnKey "^%{DEL}", "NotAllowed"
> > > > but nothing happens.
> > > >
> > > > I have even tried just looking for the CTRL + ALT
> > > > Application.OnKey "^%", "NotAllowed"
> > > > but with this I get run-time error 1004
> > > >
> > > > and if I change it to
> > > > Application.OnKey "^{%}", "NotAllowed"
> > > > or
> > > > Application.OnKey "%{^}", "NotAllowed"
> > > > nothing happens
> > > >

 
Reply With Quote
 
=?Utf-8?B?QmlsbCBQZmlzdGVy?=
Guest
Posts: n/a
 
      16th Nov 2006

Use this code then use the CAD_Disable and CAD_Enable subroutines to disable
and enable Ctrl-Alt-Del, respectively.



Option Explicit

Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_CURRENT_USER = &H80000001

Public Sub CAD_Disable()
Call ToggleCAD(True, HKEY_LOCAL_MACHINE)
Call ToggleCAD(True, HKEY_CURRENT_USER)
End Sub



Public Sub CAD_Enable()
Call ToggleCAD(False, HKEY_LOCAL_MACHINE)
Call ToggleCAD(False, HKEY_CURRENT_USER)
End Sub



Public Sub ToggleCAD(blnDisableTaskMgr As Boolean, lngUser As Long)
Dim oReg As Object
Dim strKeyPath As String
Dim strValueName As String
Dim dwValue As Long

Set oReg =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Policies\System\"
strValueName = "DisableTaskMgr"

oReg.DeleteValue lngUser, strKeyPath, strValueName

dwValue = IIf(blnDisableTaskMgr, 1, 0)
oReg.SetDWORDValue lngUser, strKeyPath, strValueName, dwValue
End Sub



"jutlaux" wrote:

> If I do this on workbook open I would like to reenable CTRL+ALT+DEL on close.
> To do this would I just change the follwoing?
>
> strValueName = "EnableTaskMgr"
>
>
> "Bill Pfister" wrote:
>
> > Sorry, I was being lazy - here's the code:
> >
> > Option Explicit
> >
> > Const HKEY_LOCAL_MACHINE = &H80000002
> > Const HKEY_CURRENT_USER = &H80000001
> >
> >
> > Public Sub ToggleCAD()
> > Dim lngUser As Long
> > Dim blnDisableTaskMgr As Boolean
> > Dim oReg As Object
> > Dim strKeyPath As String
> > Dim strValueName As String
> > Dim dwValue As Long
> >
> > blnDisableTaskMgr = True
> > blnDisableTaskMgr = False
> >
> >
> > lngUser = HKEY_LOCAL_MACHINE
> > lngUser = HKEY_CURRENT_USER
> >
> > Set oReg =
> > GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
> > strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Policies\System\"
> > strValueName = "DisableTaskMgr"
> >
> > oReg.DeleteValue lngUser, strKeyPath, strValueName
> >
> > dwValue = IIf(blnDisableTaskMgr, 1, 0)
> > oReg.SetDWORDValue lngUser, strKeyPath, strValueName, dwValue
> >
> >
> > End Sub
> >
> >
> >
> > "jutlaux" wrote:
> >
> > > I copied the code, but when the message box comes up saying "CTRL+ALT+DEL is
> > > disabled, try pressing CTRL+ALT+DEL now." I press it and it still works. I
> > > have tried running just the Disable_Ctrl_Alt_Del program below and still
> > > can't get it to work.
> > >
> > > Public Sub Disable_Ctrl_Alt_Del()
> > > 'Disables the Crtl+Alt+Del
> > > Dim AyW As Integer
> > > Dim TurFls As Boolean
> > > AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, TurFls, 0)
> > > End Sub
> > >
> > > "Bill Pfister" wrote:
> > >
> > > > http://www.planet-source-code.com/vb...=1494&lngWId=1
> > > >
> > > >
> > > > "jutlaux" wrote:
> > > >
> > > > > I have a excel workbook that is via VBA goes out to various 3rd party
> > > > > applications and gets data from them. The problem I have is that this is not
> > > > > instantaneous and even tough I have a progress bar showing things moving
> > > > > along the user will hit CTRL+ALT+DEL and end the task. This is not a problem
> > > > > for excel, but the other software applications seem to be getting "hung up"
> > > > > b/c the data transfer is not complete. Is there a way when this workbook is
> > > > > opened to disable the CTRL+ALT+DEL function?
> > > > >
> > > > > I have tried using:
> > > > > Application.OnKey "^%{DEL}", "NotAllowed"
> > > > > but nothing happens.
> > > > >
> > > > > I have even tried just looking for the CTRL + ALT
> > > > > Application.OnKey "^%", "NotAllowed"
> > > > > but with this I get run-time error 1004
> > > > >
> > > > > and if I change it to
> > > > > Application.OnKey "^{%}", "NotAllowed"
> > > > > or
> > > > > Application.OnKey "%{^}", "NotAllowed"
> > > > > nothing happens
> > > > >

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      17th Nov 2006
Personally, I think it a bad idea that you are disabling the Task Manager
because of unruly macro code interaction.
If your code crashes, users are unable to access the Task Manger for
anything.

You can make it more clear to the user that the routine is running, maybe
with a modeless userform and some 'animation'.

If it is truly long running, you could run it in a private Excel instance or
schedule for quiet times.

NickHK

"jutlaux" <(E-Mail Removed)> wrote in message
news:60F51BFE-B95D-4D86-927E-(E-Mail Removed)...
> I have a excel workbook that is via VBA goes out to various 3rd party
> applications and gets data from them. The problem I have is that this is

not
> instantaneous and even tough I have a progress bar showing things moving
> along the user will hit CTRL+ALT+DEL and end the task. This is not a

problem
> for excel, but the other software applications seem to be getting "hung

up"
> b/c the data transfer is not complete. Is there a way when this workbook

is
> opened to disable the CTRL+ALT+DEL function?
>
> I have tried using:
> Application.OnKey "^%{DEL}", "NotAllowed"
> but nothing happens.
>
> I have even tried just looking for the CTRL + ALT
> Application.OnKey "^%", "NotAllowed"
> but with this I get run-time error 1004
>
> and if I change it to
> Application.OnKey "^{%}", "NotAllowed"
> or
> Application.OnKey "%{^}", "NotAllowed"
> nothing happens
>



 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      17th Nov 2006
I would STRONGLY recommend that you NOT disable CTRL+ALT+DELETE. That is a
system wide function that users may need for applications other than yours.
There are certain things that an application shouldn't do, even if it is
possible to do so. This, and changing display resolution, are at the top of
that list. I would not use an app that did either of these things.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"jutlaux" <(E-Mail Removed)> wrote in message
news:60F51BFE-B95D-4D86-927E-(E-Mail Removed)...
>I have a excel workbook that is via VBA goes out to various 3rd party
> applications and gets data from them. The problem I have is that this is
> not
> instantaneous and even tough I have a progress bar showing things moving
> along the user will hit CTRL+ALT+DEL and end the task. This is not a
> problem
> for excel, but the other software applications seem to be getting "hung
> up"
> b/c the data transfer is not complete. Is there a way when this workbook
> is
> opened to disable the CTRL+ALT+DEL function?
>
> I have tried using:
> Application.OnKey "^%{DEL}", "NotAllowed"
> but nothing happens.
>
> I have even tried just looking for the CTRL + ALT
> Application.OnKey "^%", "NotAllowed"
> but with this I get run-time error 1004
>
> and if I change it to
> Application.OnKey "^{%}", "NotAllowed"
> or
> Application.OnKey "%{^}", "NotAllowed"
> nothing happens
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The richtextbox not receiving the keys such Ctrl+A, Ctrl+O when typedon it when hosted on web page Gouri.Mahajan7@gmail.com Microsoft ASP .NET 0 11th Jul 2008 06:27 AM
Can I set ctrl+s and ctrl+o window size & ctrl+o save as type defa Moonbarker Osbourne Windows XP General 1 18th Jan 2008 02:10 PM
Shortcut keys like Ctrl+C, Ctrl+V, Ctrl+A etc Not Working gettechtips@yahoo.co.in Windows XP General 1 23rd Sep 2006 12:43 PM
How to enable Ctrl+C, Ctrl+V, Ctrl+X in textBoxes? kari Microsoft C# .NET 1 16th May 2006 02:19 AM
Re: VB script that mimics CTRL+C, CTRL+G, CTRL+V, ENTER? Fergus Cooney Microsoft VB .NET 0 8th Nov 2003 01:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:40 PM.