Key stroke change

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2006
Posts: 17
Reputation: Bomber686 is an unknown quantity at this point 
Solved Threads: 0
Bomber686's Avatar
Bomber686 Bomber686 is offline Offline
Newbie Poster

Key stroke change

 
0
  #1
Apr 3rd, 2006
Hi,

I am using the blockinput API call, which blocks keyboard and mouse events while active. The only thing is by pressing ctrl, alt, del you unblock inputs. What I was thinking is to just change the keystroke of one of these keys, thus no ctrl, alt, del input could be achieved. I've had a look around and not got very far. Does anyone have any code to change a keystroke?

Thanks
Have Fun!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Key stroke change

 
0
  #2
Apr 3rd, 2006
:-|
Attached Files
File Type: zip TestBlock.zip (1.3 KB, 23 views)
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 17
Reputation: Bomber686 is an unknown quantity at this point 
Solved Threads: 0
Bomber686's Avatar
Bomber686 Bomber686 is offline Offline
Newbie Poster

Re: Key stroke change

 
0
  #3
Apr 3rd, 2006
You did say about this problem........... Looks like I could use this approach tho, thanks. I've report on what happens when I play with it tomorrow.

Thanks again
Have Fun!
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 17
Reputation: Bomber686 is an unknown quantity at this point 
Solved Threads: 0
Bomber686's Avatar
Bomber686 Bomber686 is offline Offline
Newbie Poster

Re: Key stroke change

 
0
  #4
Apr 4th, 2006
The way the blocktest process works is fine on my XP none domain machine at home but the machines at work are domain machines and the ctrl,alt,del event produces a security box. I've tried adjusting the code to compensate for the different box name ie.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
  2. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  3.  
  4. Private Sub Form_Load()
  5. retval = BlockInput(True)
  6. End Sub
  7.  
  8. Private Sub Timer1_Timer()
  9. retval = BlockInput(False)
  10. End Sub
  11.  
  12. Private Sub Timer2_Timer()
  13. retval = FindWindow(vbNullString, "Windows Security")
  14. If retval <> 0 Then
  15. AppActivate "Windows Security"
  16. SendKeys "{ESC}"
  17. retval = BlockInput(True)
  18. End If
  19. End Sub

But this approach don't work. Is there away of reporting what the security box handle is, then I could use the handle in the FindWindow API?

Cheers
Have Fun!
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 17
Reputation: Bomber686 is an unknown quantity at this point 
Solved Threads: 0
Bomber686's Avatar
Bomber686 Bomber686 is offline Offline
Newbie Poster

Re: Key stroke change

 
0
  #5
Apr 4th, 2006
I've used this code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Declare Function GetForegroundWindow Lib "user32" () As Long
  2. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  3.  
  4. Private Sub Form_Load()
  5. DoEvents
  6. a = 1
  7. Do Until a = 0
  8. retval = GetforegroundWindow
  9. MsgBox retval
  10. Call Sleep(10000)
  11. loop
  12. End Sub

Which hangs vb and you have to end task, but it does give the handle of the current window. The handle of the "Windows Security" box is 0, which is strange........ But I thought hey, I could use the GetForegroundWindow API to loop and then act if the foreground window changed to 0. I shall look into it.....
Have Fun!
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 17
Reputation: Bomber686 is an unknown quantity at this point 
Solved Threads: 0
Bomber686's Avatar
Bomber686 Bomber686 is offline Offline
Newbie Poster

Re: Key stroke change

 
0
  #6
Apr 4th, 2006
My head hurts!

It looks as though the ctrl,alt,del event on these domain PC's stops the PC from reporting to any running app, thus the 0 handle. Which means that once this event starts, there is no way that vb can respond to this event. So it looks as tho the keyboard mapping is the only solution.

Any ideas?
Have Fun!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Key stroke change

 
0
  #7
Apr 4th, 2006
Well, you could always look for .dll's that do system-wide keyhooks, and then trap the keysequence.... if findwindow returns 0, it did not find the window in question. You could always check for the classname of the window, and try it that way, but I think you are probably right about it not sending information to running apps. It might still respond to services, however, so you could try having your app run as a service in the registry, or look into building your app as a service. I would probably trap the keys with a systemwide keyhook, and discard the keypresses without sending them to the windows chain. Let me know what you come up with.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 17
Reputation: Bomber686 is an unknown quantity at this point 
Solved Threads: 0
Bomber686's Avatar
Bomber686 Bomber686 is offline Offline
Newbie Poster

Re: Key stroke change

 
0
  #8
Apr 4th, 2006
I've found this:

[HTML]http://www.microsoft.com/whdc/device/input/w2kscan-map.mspx[/HTML]

This is an interesting approach, it seems to work. It needs a reboot to work tho. So if I was to use it in an install account the user would have to login the mapping would get changed then the machine would reboot and autologin to complete the install and then the mapping could be removed and the machine rebooted a final time.

This poses another problem......Autologin, I've never done this before so any pointers greatfully received.

Cheers
Have Fun!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC