Firstly I know this has nothing to do with Jukes, but I thought I would throw this out here to you guys, mainly Barcrest because I believe E-touch is coded in VB, but if anyone else has some info, then feel free to chime in. I'm doing a VB6 MSComm project in XP for work, yeah I know, WORK SUCKS !!! But any way back to my question, do any of you know how I can block the Ctrl Alt Del from bringing up Taskmanager from my code? Exactly what I would like is an enable and disable.
Here is what I am doing:
form is not visible on load,
bringing in data on com5 from a scanner,
making form visible and displaying data from com5 and further messages,
send data out to com4,
blocking all mouse and keyboard inputs,
turn off com5,
sleep for 30 sec,
Unblock mouse and keyboard,
turn com5 back on
make form not visible again until next scan.
All this is working good, but can be screwed up by hitting Ctrl Alt Del, when this is hit during the sleep, for some reason the form stays visible after the 30 sec, or maybe just parts of it, after closing task manager. The rest of the code still works, and I am able to scan another code and as long as Ctrl Alt Del is not hit the form becomes not visible again and all is well. Just wondering if any of you would know how I might work around this problem.
Thanks to All
You can try this.
Quote
There is an undocumented way to disable the Ctrl Alt Del key sequence on Windows NT/2000/XP using the registry.
The key, 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon : AutoAdminLogon (REG_SZ)' has only two legal values, according to Microsoft: "0" and "1". 0 disables automatic logon of the account stored, and 1 enables it. The strange thing is that if you set the key to "2", it will enable automatic logon AND disable CTRL + ALT + DEL sequence registration by windows on boot, effectively disabling Task Manager, etc... Of course for this to work you will have to set the "DefaultUserName" and "DefaultPassword" keys to the username to automatically logon.
I've found this the easiest way to kill the Ctrl-Alt-Del sequence.
Or if you don't like tweeking the registry you can put this in your code.
Private Declare Function SystemParametersInfo Lib _
"user32" Alias "SystemParametersInfoA" (ByVal uAction _
As Long, ByVal uParam As Long, ByVal lpvParam As Any, _
ByVal fuWinIni As Long) As LongSub DisableCtrlAltDelete(bDisabled As Boolean)
Dim X As Long
X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
Private Sub Form_Load()
Call DisableCtrlAltDelete(True)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call DisableCtrlAltDelete(False)
End Sub
I tried option 2, but it doesn't seem to work, at least the way I'd like it to, fact is I see no difference whether it's there or not so I must not be using correctly. Here's my whole code, take it easy on me I just a beginner :beer
Option Explicit
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function SetWindowPos& Lib "user32" _
(ByVal hwnd&, ByVal hWndInsertAfter&, _
ByVal X&, ByVal y&, ByVal Wid&, _
ByVal Hgt&, ByVal Flags&)
Const SWP_NOSIZE = 1
Const SWP_NOMOVE = 2
Const HWND_TOPMOST = -1
Private Declare Function SystemParametersInfo Lib _
"user32" Alias "SystemParametersInfoA" (ByVal uAction _
As Long, ByVal uParam As Long, ByVal lpvParam As Any, _
ByVal fuWinIni As Long) As Long
Sub DisableCtrlAltDelete(bDisabled As Boolean)
Dim X As Long
X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
Private Sub Form_Load()
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOSIZE Or SWP_NOMOVE
MSComm1.RThreshold = 1
MSComm1.DTREnable = False
MSComm1.CommPort = 5
MSComm1.PortOpen = True
MSComm2.DTREnable = False
MSComm2.RTSEnable = True
MSComm2.SThreshold = 1
MSComm2.CommPort = 4
MSComm2.PortOpen = True
Text1.Text = ""
End Sub
Private Sub MSComm1_OnComm()
Dim InBuff As String
If MSComm1.CommEvent = comEvReceive Then
Timer1.Interval = 15000
Timer1.Enabled = True
Form1.Show
Call DisableCtrlAltDelete(True)
Text1.Text = ""
InBuff = MSComm1.Input
Call HandleInput(InBuff)
End If
End Sub
Sub HandleInput(InBuff As String)
Text1.SelStart = Len(Text1.Text)
Text1.SelText = InBuff
MSComm2.Output = Text1.Text
MSComm1.PortOpen = False
BlockInput True
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
BlockInput False
Form1.Hide
Call DisableCtrlAltDelete(False)
MSComm1.PortOpen = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
MSComm2.PortOpen = False
End Sub
Again thanks for the help
Open "c:\windows\system32\taskmgr.exe" For Random Lock Read As #1
That will stop the task manager coming up on CTRL + ALT + DEL
Close #1 ' release task manager enable ctrl+alt+del
That does work but it's not a great solution.