VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Ok, I'm just packin this stuff together =O
The only thing I haven't seen on this forum is about disabling ctrl alt delete.
--Ctrl Alt Del Here is a Link to a great article.
At first you might think it isn't possible with vb6 judging by its title.
But give things a chance ^_^ I will leave you in suspense by saying no more.
If anything, you'll be disappointed, but relieved that there is a way to accomplish it.
If you don't want to use any of the methods listed in the article,
I saw that someone posted their idea and it killed (deleted)
taskmgr.exe on a timer- because windows remakes if you delete
it from the system32 dir. A decent timer interval value is 100-500 ms.
Make sure you put On Error Resume Next in the sub that kills taskmgr.exe.
Sometimes I got a path/file access error, probably from crammed timer events.
--Hide TaskBar(only)
This will remove the taskbar graphic from the users screen.
It will not be displayed until you show it.
If the user presses the
Windows key, it will show the StartMenu,
but this can be fixed, as shown in the next example.
Search msdn or AllApi.net for the API calls used and not defined.
--Disabling Keys such as Windows, Alt+tab, Alt+Esc, Ctrl+Esc, W+L,W+R,W+F,..etc.
I used the low level hook from merrion_computing's eventvb.dll.
It seems to work just as good as a soldering iron, except that
you can actually change it back just by running the unhook code ='(
I didn't use modules as much as I could have because I was
getting the shortcut keys received by windows and processed..
(rarely, but still happened), and I thought less code jumps might eliminate the problem.
It could have been because I was running from vb.
With an executable, I can't get anything to pass through,
no matter how fast I press.
This code could be changed somewhat, but I just did what I needed to do to get it to work fast.
Download the dll in the attachment
-reg it on your system by typing in run "regsvr32 " & [filename]
-open up a project and add the reference named "MCL Event VB Release _ "
Put in general declarations area:
VB Code:
Private Declare Function MessageBeep Lib "user32" (ByVal wType As Long) As Long
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private WithEvents apiLink As EventVB.APIFunctions
Private WithEvents hook As EventVB.ApiSystemHook
Private Const vbKeyLWin As Integer = 91
Private Const vbKeyRWin As Integer = 92
Private Const vbKeyLCtrl As Integer = 162
Private Const vbKeyRCtrl As Integer = 163
And then for the events:
VB Code:
Private Sub Form_Load()
Set apiLink = New EventVB.APIFunctions
Set hook = apiLink.System.Hooks
hook.StartHook WH_KEYBOARD_LL, HOOK_GLOBAL
End Sub
Private Sub Form_Unload(Cancel As Integer)
hook.StopHook WH_KEYBOARD_LL
Set hook = Nothing
Set apiLink = Nothing
End Sub
Private Sub hook_KeyDown(ByVal VKey As Long, ByVal scanCode _
As Long, ByVal ExtendedKey As Boolean, ByVal AltDown As _
Boolean, ByVal Injected As Boolean, Cancel As Boolean)
'Alt Tab
If AltDown And VKey = vbKeyTab Then
Cancel = True
'Alt Esc
ElseIf AltDown And VKey = vbKeyEscape Then
Cancel = True
'Ctrl Esc
ElseIf VKey = vbKeyEscape Then
'Check if a ctrl key down
If GetKeyState(vbKeyLCtrl) And &HF0000000 Or _
GetKeyState(vbKeyRCtrl) And &HF0000000 Then
Cancel = True
End If
'Windows key (L/R). Used to "disable" the start menu.
'Stops single keydown of a windows key
ElseIf VKey = vbKeyLWin Or VKey = vbKeyRWin Then
Cancel = True
'Windows + Any
'If there is a hotkey combination being pressed,
'the Windows key will not be stored in VKey,
'So I check the state of the windows keys.
'If they are down, cancel keys
Else
If GetKeyState(vbKeyLWin) And &HF0000000 Or _
GetKeyState(vbKeyRWin) And &HF0000000 Then
Cancel = True
End If
End If
'This is totally optional of course
If Cancel = True Then 'We have stopped some keystrokes. Beep
MessageBeep 0
End If
End Sub
And that's it. Post comments! =p If you see any errors, post, so we can get them fixed.
Thanks! Enjoy.
Last edited by wordracr; Dec 22nd, 2010 at 07:52 AM.
What would you acomplish by disabling native windows shortcuts except disabling the user? I could only see this being used for virus development - in which case it's setting a bad 'example' to have in the codebank... Just my two cents.
Cheers!
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Plenty of people have asked, and there are many appropriate uses.
Any app dealing with security of the machine can find things like this helpful. Do I need to go into details? lol. win+R = run anything u want, which can be a problem for the system admin if users can do whatever they want.
People keep saying why would you want to disable ctrl+alt+del. Well, can you give me a reason for it? If there is a login program running, why should the user be able to shut it down? Or maybe there is something i'm missing.
Originally posted by wordracr Plenty of people have asked, and there are many appropriate uses.
Any app dealing with security of the machine can find things like this helpful. Do I need to go into details? lol. win+R = run anything u want, which can be a problem for the system admin if users can do whatever they want.
People keep saying why would you want to disable ctrl+alt+del. Well, can you give me a reason for it? If there is a login program running, why should the user be able to shut it down? Or maybe there is something i'm missing.
I still stand by my opinion - unless you're making a windows replacement shell - forget about using it.
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Why, I am designing an aplication for teachers at my school at the moment to enable teachers to take control over the students computers. This helps them to moniter students computer screens and freeze them If there not doing their work (evidence for detension )
Although I do share your opinion about providing opurtunities for hackers good people like myself also use these API's
Scott
**********
Visit my web page at www.hyphenex.ugtech.net
Originally posted by king_scott_2 Why, I am designing an aplication for teachers at my school at the moment to enable teachers to take control over the students computers. This helps them to moniter students computer screens and freeze them If there not doing their work (evidence for detension )
Although I do share your opinion about providing opurtunities for hackers good people like myself also use these API's
That's exactly yhe problem, I haven't seen you in person - therefore I really don't know if you are one of the 'good' people. And seriously, people trying to make viruses using VB is just n00b hackers, so I want supply them ****(to spare them from seeing themself fail miserably )
Cheers!
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Well. We have to give people resinable doubt. By the way, If 5 million people want this code surly one of them must want it for a good reason. Does it not say in the bible if a town of 5000 have sinned buy yet one remaines without sim then you must spare the town.
Scott
**********
Visit my web page at www.hyphenex.ugtech.net
Originally posted by king_scott_2 Well. We have to give people resinable doubt. By the way, If 5 million people want this code surly one of them must want it for a good reason. Does it not say in the bible if a town of 5000 have sinned buy yet one remaines without sim then you must spare the town.
[Edited by MartinLiss] - And if the other 5 million n00b hackers got it and leaked bad written crap viruses all over the net, just for one 'good' to be happy, that's crazy...
Last edited by MartinLiss; Dec 29th, 2004 at 11:36 AM.
Reason: offensive
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
I developed sometime ago some sort of tracking application
for a friend's internet cafe (basically monitors customers start time and informs the user how much time he/she had used). It was doing along well until some smart-aleck used the CTRL-ALT-DEL. It was partially solved by hiding the process from the taskmanager but this vbCode would have been easier to implement
I use similar code for a computer locking program.
Many users cannot restart their computer while on networks without getting the administrator involved. If they leave their desk for any period of time their data is available to anyone.
Locking programs allow the user to protect their data while doing other tasks. There is no need to turn off the computer or get the administrator involved at all.
My program uses substitution key entry as well to avoid key logger programs from saving and logging the user passwords.
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
okay i dont get this to work,i copyed the code exactly as you said but i dont know what you mean by"MCL Event VB Release _" i tried adding it to the code but it doesnt work :S help please ?:S
i got kicked out of barnes and noble once for moving all the bibles into the fiction section"--FD
Of course I'm a real doctor! I'll draw up my own diploma some time to prove it!-Dr Dis
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Originally Posted by vbNeo
I still stand by my opinion - unless you're making a windows replacement shell - forget about using it.
Eh... I could see another use -- a kiosk application. You know the free-standing kind that sit out in the middle of walkways of malls and such. If I had such a application that I was running unattended like that, especialy with a keyboard, I don't think I'd want the users to be able to get to the Windows menu or anything. That would be quite bad. There are certain applications when it would be appropriate to disable such things. A call center for instance. THey only need to run their call app and nothing else. Hopefully the developer is responsible enough to restore things when the app exits, but other than that, it's a perectly valid use.
Granted it could be used for malicious intent, but so could half the code on VBF. It's up to YOU to make sure you know the source of any code you run. That's why most of us here will not run attached programs, but rather ask for the code instead. Then it can be inspected for malware.
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Disabling control keys is useful if you want to be able to control the user's session without having to write your own GINA. The person who wrote about not seeing any other application for this sort of thing except for virus writers is just showing their ignorance of Windows programming.
For example, I have an application that uses this code - it ties the user's login to a USB flash drive. When the user turns on the machine, he is prompted to insert his USB key. The udentity is validated, and the user is allowed to proceed. When the USB drive is removed, the ALT+TAB key sequence is disabled (as well as CTRL+ESC, etc.), so that the user has to re-insert the same USB drive in order for the system to become operational again.
This allows a user to lock the session without having to call LockWorkStation and have to type their password when they return - just re-insert the USB drive and everything is restored to what it was before. The user can always hit CTRL+ALT+DEL (which can't be disabled easily in XP), but I've disabled all the buttons on that form except for Log Off and Cancel.
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Funny, thats exactly why I am reading this forum. I am writing a kiosk program for the college computer center I work in. We have huge problems with the students hacking into the computers. The kiosk uses XP. For me this code is perfect. I seriously doubt that any virus' will come from this thread. Going by that logic all code should be kept under lock and key? Doh!
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
will this work in windows 98??? i used a similar program that would "eat" low level keys. it works perfectly in xp and 2000 but when i used it in windows 98, after a while, the program hangs up
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Only the GOOD programmers know how to disable Ctr + Alt + Delete... and the hackers... usually.... anywayz...
I am hoping that someone with reasonable knowledge could post the code so that i can use it to learn from. It can be very usefull. As for the hackers, if they did have the code, it would be bad. But they aren't smart enough to distribute their virus. And if they are, then they already know how to disable Ctr + Alt + Delete.
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Originally Posted by techgnome
Eh... I could see another use -- a kiosk application. You know the free-standing kind that sit out in the middle of walkways of malls and such. If I had such a application that I was running unattended like that, especialy with a keyboard, I don't think I'd want the users to be able to get to the Windows menu or anything. That would be quite bad. There are certain applications when it would be appropriate to disable such things. A call center for instance. THey only need to run their call app and nothing else. Hopefully the developer is responsible enough to restore things when the app exits, but other than that, it's a perectly valid use.
Granted it could be used for malicious intent, but so could half the code on VBF. It's up to YOU to make sure you know the source of any code you run. That's why most of us here will not run attached programs, but rather ask for the code instead. Then it can be inspected for malware.
Tg
Touché
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Disabling the ability to close an application and access the operating system is extremely important on the factory floor if you are using VB for your operator interface to control a machine. If not, a very expensive piece of equipment becomes a giant paper weight after somebody screws up the operating system whether by accident or on purpose. Some people might also try to play games on the machine computer which makes the boss angry.
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Hello, first of all I disagree with this becoming a source of viruses and the like. AND I know this thread is almost a year old inactive but, I wanna know if there's something like this that can be used for .NET? I tried upgrading this to .NET but it gives 100+ error messages. Any suggestions? Or can someone give me a precompiled dll?
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Hi, I found the code useful for a security application I've written for a state prison. I'm a correctional officer there but I'm also a programmer on the side and I do much of their IT work so remember that this is the opinion who deals with programming and criminals alike so I see both sides. In the end, I think it's of benefit for legitimate programmers to know and understand how to do things like this, even if the bad guys learn it as well. There are firewalls, virus scanners, and IT policies and procedures in place with most companies that prevent malicious programs from being installed on computers so the risk to others is minimal.
In my case, and many IT professionals out there, it is of great benefit to have the information on how to do things such as this in our arsenal.
Again, I found the information here useful and I implemented it into a computer system that is sometimes in close proximity to incarcerated individuals. Sure, there are other physical precautions to keep inmates away from the computers, but like I always tell people.. When your in the business of security, there is no such thing as too much.
The code shown here helped with the <CTRL><ESC>, <ALT><TAB> keys and such. I had already figured out to tell Windows to hide the taskbar and desktop icons so all thats visible on the desktop is the program. Before using this code, however, people could still use the "WINDOWS" keyboard key to bring up the start menu, a definite vulnerability.
I also needed to disable the <CTRL><ALT><DELETE> combination. I did try the repeated deleting of the TASKMAN file but this didn't prove effective. The simplest and most effective method I found so far to effectively "disable" this (and aggregate the attempting person to no end haha) is to have a timer that runs approximatley every 100ms and attempts to AppActivate the "Windows Task Manager". If successful, it issues a SendKeys <ALT><F4> which in effect closes the Task Manager immediately after they open it so it's useless to them.
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
I have been working on a replacement locking program for windows xp. I created in so it works without admin privedges by just using the windows API. Due to the way the college system works, the program does it job and works perfectly. When you hit the ctrl alt del combo it shows the window security dialog with options to logoff, shutdown etc. It stops task manager on an interval of 500ms which stops users closing the application. The program also has an option to logoff. Say it was being misused you could either restart the computer, or you can hit the logoff button on the program. I still need to iron out the bugs, but it works and it does the required job perfectly, with several customizable options. But to be able to block ctrl alt del without admin privedges, and not using the registry would be the best option, so if there is a way to do it, it would be cool to know. I programmed the entire program in VB6 without custom controls, I only used the windows API.
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
I think I used something Similar, for when I was at college, so I could lock out the computer and also stop people from attempting to log off or hijack it , since the college network was so slow I couldnt be bothered with logging off and waiting 10 mins to log back in, when I could simply lock the system
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Hi All..
Anyone could provide me a redirection to the EventVB.dll download site. The URL provided in this thread isn't working anymore.. Or someone could please give a link to the file.. I need this badly...
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
Originally Posted by raamaya2
i fugured it out.. this is so cool.. now our agents are unable to use any key combination that i specify...
i think you got this to work..
i want this for adding security to my system..can you help me to work out???
Bcoz i am new to vb and i am finding same problem as you while starting...
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
How do I add the file into the resources? And when I copied the code there were some errors like:
Type 'EventVB.APIFunctions' is not defined.
Name 'WH_KEYBOARD_LL' is not declared.
Name 'HOOK_GLOBAL' is not declared.
Name 'WH_KEYBOARD_LL' is not declared.
Name 'vbKeyTab' is not declared.
Re: VB-Disable Ctrl Alt Del in XP, Hide TaskBar, Disable Windows keys
One use for it is simple.
I develop for a company that places carputers in cop cars along with a house developed "OS"
it still runs over windows, but other than the windows key, there is no way for them to directly open windows
We need a way of disabling the windows key on a keyboard
by what i've seen here, i could incorporate code into my "watchdog" proggy instead of editing it on the registry of every computer installed, which would be extremely benificial since my watchdog proggy is updated over network where as reg edits have to be done manually
I would like to use this code, but the links i've tried to your dll seem dead and the other i found at that site included extreme overkill (no dll's but plenty of other info) but nothing i can find yet allows me to simply disable windows key
disabling it in .net08 for 9x and me was a pain in api but i've yet to find anything for getting it to work for XP (old code not working)
anyway, any advice on how to get it working, or arrows you can through would be nice, maybe was addressed earlier, i'll reread, but again, if this will disable the Winkey in XP, I can think of one great use for it!