Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-10-07
18
Medium Priority
?
17,494 Views
Last Modified: 2011-08-18
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).


0
Comment
Question by:mrxcol
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +7
18 Comments
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 1600 total points
ID: 12256150
You need to Hook the Keyborad events and process them before Windows Processes them, and block the keyboard events from reacvhing Windows in case you want to Disable the Keyboard. However the issue is How and on what event would you re-enable the keyborad, I can not think of anything except Timer. Anyway here'e the code to hook keyboard with good explanation:

http://www.codeguru.com/vb/gen/vb_system/keyboard/article.php/c4829

0
 
LVL 11

Expert Comment

by:pratap_r
ID: 12257225
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
0
 
LVL 1

Author Comment

by:mrxcol
ID: 12265073
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
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Expert Comment

by:AjithJose
ID: 12271958

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


0
 
LVL 1

Author Comment

by:mrxcol
ID: 12273092
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.
0
 
LVL 4

Expert Comment

by:AjithJose
ID: 12273392
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


0
 
LVL 1

Author Comment

by:mrxcol
ID: 12572061
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.
0
 
LVL 1

Expert Comment

by:suryaxchange
ID: 12693715
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.
0
 

Expert Comment

by:computer2007
ID: 12801454
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
0
 

Expert Comment

by:nastufa
ID: 12829178
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)?
0
 

Expert Comment

by:adam_bailey
ID: 12845328
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
0
 

Expert Comment

by:nastufa
ID: 12847557
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.....
0
 
LVL 1

Author Comment

by:mrxcol
ID: 12863584
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 ?

0
 
LVL 10

Expert Comment

by:jobrienct
ID: 15107224
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





0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question