Link to home
Start Free TrialLog in
Avatar of mrxcol
mrxcol

asked on

How to fully disable keyboard using VB for the whole computer (not only for the app)

Hi. I ' making a web cafe program and we're using pre-paid system. When the time ends up, i want to disable the keyboard and mouse so the session may be re-activated only through a TCP connection  with the server i have on the backrgound.

I'm needing this because whe have some games our clients can use. The games are launched from the VB app from a ShellExecute call. But when the time end ups if our clients are inside a game i can't simply exit the game because i want user to simply lose control over the keyboard and mouse (i won't put a black screen or something like that because that would mean dealing with video and other stuff.

This way, the user would have to buy more credits. After doing that, the server app would enable again the kb and mouse. if after 2 minutes the clients doesn't add credits, the application would restore kb and mouse and shutdown the PC.

So, i need to disable the keyboard for the whole computer (not only for the application, because the application would remain minimized when playing. I would like to know if this can be done in VB 6 (i don't know nor have .NET).


ASKER CERTIFIED SOLUTION
Avatar of arif_eqbal
arif_eqbal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
keyboard hooks may not prevent all apps from freezing. which OS are you using? may be you could lock the system instead of disabling the keyboard and have the user account suspended. this way you dont have to deal with the video yourself
Avatar of mrxcol
mrxcol

ASKER

The OS depends on which can be easier to work with. I would prefer XP but if neccessary i would use win98.  I wil  r e-enable keyboard and mouse through a TCp connection which controls the application.

How's that about locking the system ? i need the system to be able to mantain the TCP connection to the server in order to re-gain keyboard access.

I'll check the link to codeguru. Seems to work butl will chech tomorrow and will post again

You can call the API function BlockInput() to disable keyboard and mouse

It works with win98, win2000

Private Declare Function BlockInput Lib "user32" (ByVal vKey As  Integer) As Integer

BlockInput (True) 'disable mouse and keyboard
BlockInput (False) 'enable back mouse and keyboard

Refer following msdn url:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/BlockInput.asp


Avatar of mrxcol

ASKER

Well, actually i already knew that one (BlockInput). But it doesn't disable CTL-ALT-DEL. That's why i need somethig more reliable than that.
To disable ctl-alt-del, you can try the API function SystemParametersInfo() in win9x.

The ms url

http://support.microsoft.com/default.aspx?scid=kb;en-us;161133

demonstrates the method in detail

Together with BlockInput() you can achieve the desired result


Avatar of mrxcol

ASKER

Although i didn't try it, none of the comments answers my question. One gave partial info (blocking with SystemParameter and BlockInput doesn't work when "leaving" the application, for example when calling a game from inside the application it re-gains ALT-TAB and CTRl-ALT_DEL access. I couldn't find a way to have the keyboard fully suspended.

Well, i didn't try arif_eqbal link. I'll try again with that (it's some kind of low level VB) and i think i can give the points to him.
Hi,
Write a windows service or a executable which hooks the windows messages and return back the key board and mouse events with out passing to the application.Write a COM executable, it can be started from the  remote computer also.You need to write a client to this COM executable and put it in the server and execute this client application by giving the name of the computer as a input so that it starts the server application which disables the keyboard.

Thank you,
Surya.
use this code to disable both keyboard and mouse add a command button and in theclick even the code.
this code disable mouse and keyboard for 10 seonds (sleep 10000) increase intervale for disabeling or disable the sleep code for perment block and make tru when u want


rivate Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
 DoEvents
    'block the mouse and keyboard input
    BlockInput True
    'wait 10 seconds before unblocking it
    Sleep 10000
    'unblock the mouse and keyboard input
    BlockInput False


End Sub
Hi. I ' making a spyware program and we're using pre-paid ads to generate revenue. The user will click (accidently of course) on an ad, upon doing this I would like to disable the keyboard and mouse so the user would not be able to shutdown the ad. I want to disable the keyboard and mouse so the session may be re-activated only through a TCP connection  with the server i have on the backgound of another zombie machine I control from a virus I sent out last month.  However, When the time ends/runs up, I would like to the user to regain control of his computer (what he/she thinks).

I'm needing this because we have some ads our clients can use/view, however the ads are typically closed upon opening. The ads are launched from a zombie machine we control because someone was not wise enough to update their machine. But when the user closes the ad  i can't simply close down the computer because i want user to simply lose control over the keyboard and mouse (i won't put a black screen or something like that because that would mean he wouldn't see the ad either).

This way, the user would be brainwashed to buy more of the advertised material. After doing that, the server app would enable again the kb and mouse. if after 2 minutes the client doesn't purchase the advertisers products the application would run advertisements on the PC 24/7 disabling the keyboard, mouse, power button, etc...

So, i need to disable the keyboard for the whole computer (not only for the application, because the application would remain minimized when playing. I would like to know if this can be done in VB 6 (i don't know nor have .NET).



Questions might at first seem legitimate but if a spyware computer programmer were viewing this site think of the useful information he would gain to write more malicious spyware. Is it appropriate to answer any question regardless of the purported applications of said advice? I thought most spyware is written in VB is it not (or java)?
dear nastufa

I dont know if you have computers in your new home (jail) lol

i dont see the point in you making this type of program because if you block input and stop the power button from being use the user would just turn it off at the wall
Average users know about the electric cord/plug?

 
I was making a parody on the original question.....

But seriousness aside I wanted to note the potential uses of such code. The poster mentioned why he wants this and he might be generally sincere, although he might also pose as a spyware/adware programmer who uses these boards to write more threatening adware.

If you would have read my entire post you might have realized some of the above.....
Avatar of mrxcol

ASKER

I fact i endep up this thread  long ago. I got tired of looking for a solution and found that it's way beyond my coding knowledge. It requieres C i think.


Actually i found a web caffe program which does exactly this thing. I guess most of this programs are designed to deal with games (let the run any app the administrator wants) and internet. Also, they had the same pre-paid system. I went to astalavista and found the crack so now i'm using it. Thanks anyway ! if i'd be a spyware programmer i think i would be porr if i would know this kind of things. In fact, in astalavista i could get access to this kind of code but didn't hesitate to code. What for ?

Pretty much any bit of information like this is readily available. Keyboard and mouse hooks are certainly legitimate questions with appropriate uses, of course they can be misused, but so can a rock.. you wouldn't ban people from picking them up just because it's possible to throw them would you?

For my part I need to disable input during a screen capture / encoding session because I can't reliably turn off the mouse pointer - and i don't want a mouse pointer in my movie.

And I just absolutely love that I can post to this year old thread <g>

John