Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords:
We are using WinBatch version 2008A.
On our desktops (Dell GX270 with XP SP3) they both seem to work fine. On our laptops (Dell D820 with XP SP3) these functions exhibit the following behaviors using the WinBatch help file example:
The laptop keyboard seems to be functioning correctly otherwise.
IsKeyDown() seems to work fine on both laptops and desktops. For our current use IsKeyDown() is suitable so this post is mostly curiosity.
Thanks for any insight.
Is it possible you have some utility running on the system that attempts to interfere with what it thinks is a 'key logger' program?
I suspect some other application is also attempting to log keystrokes. Due to the pre-emptive multitasking nature of Windows, another application can look for the "recently pressed" key instead of your application. Causing winbatch to miss the keypresses.
Or maybe some spyware or anti-virous utility is installed that attempts to interfere with this type of operation.
It might be interesting to look at a list of all the running processes on these laptops.
WorkAround:
Here is some code that uses different method of monitoring keystrokes.
;Slighty different method to grab the keys. #DefineFunction GetKeyboardState(buf) sDLLName = StrCat(DirWindows(1), "user32.dll") DllCall(sDLLName, long:"GetKeyboardState", lpbinary:buf) BinaryEodSet(buf, 256) Return buf #EndFunction ;============================== ;start ;============================== DebugTrace(@ON , 'c:\trace.txt') BoxOpen("","Press any key.") buf1 = BinaryAlloc(256) buf2 = BinaryAlloc(256) before = GetKeyboardState(buf1) after = GetKeyboardState(buf2) While BinaryCompare(before, 0, after, 0, 256)==@TRUE after = GetKeyboardState(buf2) EndWhile GoSub get_the_key BinaryFree(buf1) BinaryFree(buf2) ;============================== Exit ;============================== :get_the_key key = "" For count = 0 To 255 x=BinaryPeek(buf2,count) If x<>0 && x<>1 Then Break Next Select count Case 9 key = "Tab" Break Case 13 key = "Enter" Break Case 16 key = "Shift" Break Case 17 key = "Ctrl" Break Case 18 key = "Alt" Break Case 20 key = "CapsLock" Break Case 27 key = "Escape" Break Case 32 key = "Space" Break Case 33 key = "PgUp" Break Case 34 key = "PgDn" Break Case 35 key = "End" Break Case 36 key = "Home" Break Case 37 key = "Left arrow" Break Case 38 key = "Up arrow" Break Case 39 key = "Right arrow" Break Case 40 key = "Down arrow" Break Case 45 key = "Insert" Break Case 46 key = "Delete" Break Case 187 key = "=" Break Case 189 key = "-" Break Case 112 key = "F1" Break Case 113 key = "F2" Break Case 114 key = "F3" Break Case 115 key = "F4" Break Case 116 key = "F5" Break Case 117 key = "F6" Break Case 118 key = "F7" Break Case 119 key = "F8" Break Case 120 key = "F9" Break Case 121 key = "F10" Break Case 122 key = "F11" Break Case 123 key = "F12" Break EndSelect If key == "" Then key = Num2Char(count) Message(count, key) Return
Laptop (not working) Desktop (working) ApntEx#0|3892 Apoint#0|3716 BCMWLTRY#0|1404 CNTAoSMgr#0|3420 ctfmon#0|2140 CTSVCCDA#0|1516 DataServer#0|1860 dpmw32#0|3912 DVDLauncher#0|964 hidfind#0|3884 igfxpers#0|3112 NicConfigSvc#0|2020 OfcPfwSvc#0|260 pctsAuxs#0|1888 pctsSvc#0|1916 pctsTray#0|3060 QN1928#0|2472 quickset#0|4028 RRAD27#0|2712 scardsvr#0|1600 SnReg1S#0|1824 TmProxy#0|872 WindowsSearch#0|3532 WindowsSearchFilter#0|1200 WindowsSearchFilter#1|3968 WindowsSearchIndexer#0|3668 WLTRAY#0|3968 WLTRYSVC#0|1392 wmiprvse#1|3800
I wonder if you got that kind keyboard and it is confusing the issue.
Something unusual must be getting involved. There are no known issues with this function. At this point I believe the issue is either hardware related or some application or utility is involved.
I recommend checking for hardware updates from Dell and disabling processes one by one until the culprit is found.
Article ID: W17900
Filename: WaitForKey Issues.txt
File Created: 2008:07:03:10:32:22
Last Updated: 2008:07:03:10:32:22