Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: disable user input ignoreinput BlockInput CTRL ALT DEL
I tried forcing users to enter information by the int 12 10 but it still lets ctrl-break end script Please help...
For Windows 95/98 there is IntControl 57, but I can't really recommend it for any machine where people are expected to get work done.
Is there a way to stop a user from launching apps or doing other things while this winbatch .exe file runs?
BlockInput blocks input except if Winbatch is waiting for input. And Ctrl-Alt-Del cancels the BlockInput, to get back input.
The BlockInput function under different OSes has the following behavior:
Under Win95b and NT 4.0 workstation, it returns the error "1301:
DllCall: Bad Entrypoint name". It works fine on Win98se, Win2000pro, and WinXPpro.
So some modifications need to be made to the DllCall for these systems.
Blocking CTRL-ALT-DELETE on NT4 or W2K is a security risk, because it could cause not being able to log on any more. Under Win2000, with the BlockInput you can still CTRL+ALT+DEL and get back keyboard and mouse control.
You can work around the ctrl-alt-del issue on nt/w2k boxes by throwing the right registry switches to turn off the options in the ctrl-alt-del box. This way the user COULD hit ctrl-alt-del, but everything would be greyed out if they did, so it was useless to them. Of course the problem with this method is if your script crashes or something happens, then someone will have to go into the registry and put those back again!
For those of you running NT4 sp6 who can't use the ignoreinput function, this UDF mimics it.
#definefunction BlockInput(flag) dllfile=strcat(dirwindows(1),"user32.dll") if flag==-1 ;find and return current state if !dllcall(dllfile,long:"BlockInput",long:@TRUE) return @TRUE else dllcall(dllfile,long:"BlockInput",long:@FALSE) ;turn it back off return @FALSE endif endif ;otherwise... if flag>0 then flag=@TRUE ;just in case return dllcall(dllfile,long:"BlockInput",long:flag) #endfunction
What normally causes users to hit keys, mice, etc. is if they see a box on the screen prompting for a response. Since I use SendKeysTo and SendKeysChild in my scripts, this keeps unwanted fingers out by essentially blinding them to what is happening in the background. You may have to make adjustments to the fonts and sizes depending on the messages that you call..
;Force WinBatch boxes to stay on top.... IntControl(54, "", 1, 0, 0) IgnoreInput(@TRUE) ; initialize text color strings that we use for messages t1="0,255,0" ;green text-for general messages t2="255,0,0" ;red text-for error messages t3="255,255,0" ;yellow text-for warning messages BoxesUp("0,0,1000,1000", @ZOOMED) BoxCaption(1, "Installation - Go for a coffee!") ; set color to green and msg and call subroutine c=1 ; may have to "play around" with font settings and sizes depending on BoxColor(1,"255,0,0",6) ;sets the background color BoxDrawRect(1,"0,0,1000,1000",2) ;object which will use the color BoxTextColor(1,"0,255,0") BoxTextFont(1,"Times Roman", 75, 70, 18) BoxDrawText(1, "150,150,850,300", "Please do NOT touch keyboard or mouse", @FALSE, 1) BoxTextColor(1,t%c%) BoxTextFont(1,"Helvetica", 65, 80, 34) BoxDrawText(1, "150,600,850,600", "%msg%", @TRUE, 1) ;;;;;YOUR CODE GOES HERE;;;;;;;;;;;; ;Example: Run("notepad.exe","");runs notepad TimeDelay(2);waits two seconds SendKeysTo("~Notepad","!fx");closes notepad TimeDelay(2);waits two seconds Exit
Here's as trick, to disable the keyboard and mouse, but it only seems to work on Windows 95 / 98 (Systems that have Both RunDll32.dll and rundll.exe).
The following commands are not supported on Windows NT /2000. They will have no affect on NT/2000.
NOTE: Once this command is called you will *have* to REBOOT you system to get the MOUSE back.
Run("rundll32.exe","mouse,disable")
NOTE: Once this command is called you will *have* to REBOOT you system to get the KEYBOARD back.
Run("rundll32.exe","keyboard,disable")
A WB user provided the following:
I can think of a couple of possible solutions depending on the operating system you are using and how much programming you want to carry out.
With Windows 3.1, I had some success with writing a "shell program" in winbatch that ran as a shell over progman.exe and therefore allowed you to intercept all logins and logouts, shut down apps, etc.
I have seen some third party products that do something similar with NT4, although I can't recall their names. Once again, they work as a Shell around the Explorer desktop, so you can intercept all application launches.
You could create a simple winbatch launcher program that is called by any shortcut on your user desktops, and defers execution until a flag file or registry entry or whatever, is set or cleared according to your login process.
I am also led to believe that there are some API hooks in NT4 that allow you to hook code into the process that executes a shortcut when you click on it. You could therefore have a generic delay on starting apps if Winbatch is running. I'm afraid I don't have any details on this though.
Article ID: W13253
Filename: Disable User Input.txt
File Created: 2003:06:16:13:18:44
Last Updated: 2003:06:16:13:18:44