WOW, thanks Rich. I hope you had this laying around, or that it was easy to do. I appreciate the work on it either way!
Can we put this in the BWS Library? I know that it is going into my BWS toolkit! (I guess now I should copy it in and be sure it works, eh?) You da' man, Rich!! Lew Hundley Information Specialist - Programmer Silverton Hospital Silverton Oregon 503.873.1657 [EMAIL PROTECTED] -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich McNeil Sent: Thursday, August 07, 2003 1:02 PM To: [EMAIL PROTECTED] Subject: RE: [Talk] CAPSLOCK and NUMLOCK Lew, The following script allows you to test for the value of these keyboard settings and toggles them on or off as necessary: Option Explicit Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Private Const VK_CAPITAL = &H14 Private Const VK_NUMLOCK = &H90 Private Const KEYEVENTF_EXTENDEDKEY = &H1 Private Const KEYEVENTF_KEYUP = &H2 Sub TestKeys() If (GetKeyState(VK_CAPITAL) And 1) = 0 Then 'if CAPS Off then set On keybd_event VK_CAPITAL, 0, KEYEVENTF_EXTENDEDKEY, 0 'toggles CAPS_LOCK keybd_event VK_CAPITAL, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0 DoEvents End If If (GetKeyState(VK_CAPITAL) And 1) = 1 Then 'if CAPS On then set Off keybd_event VK_CAPITAL, 0, KEYEVENTF_EXTENDEDKEY, 0 'toggles CAPS_LOCK keybd_event VK_CAPITAL, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0 DoEvents End If If (GetKeyState(VK_NUMLOCK) And 1) = 0 Then 'if NUMLOCK Off then set On keybd_event VK_NUMLOCK, 0, KEYEVENTF_EXTENDEDKEY, 0 'toggles NUMLOCK keybd_event VK_NUMLOCK, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0 DoEvents End If If (GetKeyState(VK_NUMLOCK) And 1) = 1 Then 'if NUMLOCK On then set Off keybd_event VK_NUMLOCK, 0, KEYEVENTF_EXTENDEDKEY, 0 'toggles NUMLOCK keybd_event VK_NUMLOCK, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0 DoEvents End If End Sub Rich McNeil Boston Software Systems 866 653 5105 www.bostonworkstation.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lew Hundley Sent: Thursday, August 07, 2003 2:49 PM To: BostonWorkStation Talk Subject: [Talk] CAPSLOCK and NUMLOCK (Win2000, BWS 6.5 rev 118, VBA, working with Meditech Magic 4.9, Meditech NUI Workstation and HSS WinStrat ver 0304 applications) Hi gang! I am Beta testing my script/interface with a user so that I can test with live data (seems that the random entry of numbers, especially encoder numbers in ABS is not a reliable test, as I am finding out quickly). My user gets frustrated that while the Meditech and WinStrat application windows are getting/changing focus during the running of the script, the CAPSLOCK and NUMLOCK keys get disabled (probably enabled too, but the frustration is with the disabling). Is there any way anyone has found to either lock the keys so they don't change, or to ensure that the keys are enabled by a command from the script. I saw the Console Connection portion of the BWS Help, but it doesn't appear to be what I want. Perhaps I can stick some VB code in the script to take care of this. I am just in a time crunch, and wanted to see if anyone else had done this from the script. TKs Lew Hundley Information Specialist - Programmer Silverton Hospital Silverton Oregon 503.873.1657 [EMAIL PROTECTED]
