CAPS LOCK?

#1
Another recent thread made me fool around a bit with KEYBD /C.

In a new TCC session, "KEYBD /C" will toggle CapsLock on/off (but not off/on) exactly once; thereafter it will do nothing.

Exiting TCC after "KEYBD /C" once leaves CapsLock on ... in another new TCC, "KEYBD /C" does nothing, "KEYBD /C0" will turn CapsLock off and another "KEYBD /C0" will turn it back on and further "KEYBD /C0"s do nothing.

Also, in a new TCC "/c1, /c1" (abbreviating now) will turn it on/off (and then become useless, like /C alone) ... then /C0 will turn it on (and become useless, like /C1) but a /C will turn it off.

I can't make sense of it. Any of the three (/C, /C0, /C1) **may** toggle the state and none of them work more than two times in a row.
 
#2
vefatica wrote:
| Another recent thread made me fool around a bit with KEYBD /C.
|
| In a new TCC session, "KEYBD /C" will toggle CapsLock on/off (but not
| off/on) exactly once; thereafter it will do nothing.
|
| Exiting TCC after "KEYBD /C" once leaves CapsLock on ... in another
| new TCC, "KEYBD /C" does nothing, "KEYBD /C0" will turn CapsLock off
| and another "KEYBD /C0" will turn it back on and further "KEYBD /C0"s
| do nothing.
|
| Also, in a new TCC "/c1, /c1" (abbreviating now) will turn it on/off
| (and then become useless, like /C alone) ... then /C0 will turn it on
| (and become useless, like /C1) but a /C will turn it off.
|
| I can't make sense of it. Any of the three (/C, /C0, /C1) **may**
| toggle the state and none of them work more than two times in a row.

I have somewhat similar observations. My TCSTART has performs the command
below twice:
KEYBD /S1 /C0 /N1
which always leaves the keyboard in the desired state. Manual issuance of /C
after arriving at the prompt only toggles a few times (I think 3),
thereafter it is dead. However, manually toggling CAPS LOCK allows another 3
command-line toggles.

I had problems with the /S0 option ever since it became available, e.g.,
changing the keyboard light but not the actual scroll lock state. The few
times scroll lock i srelevant I control it manually.

My tests were performed using WinXP Pro SP#, with a USB keyboard (with
numerous properly functioning Windows-control keys, e.g., calculator, mute,
etc.).
--
Steve
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#3
> In a new TCC session, "KEYBD /C" will toggle CapsLock on/off (but not
off/on)

> exactly once; thereafter it will do nothing.
Your syntax is incorrect; /C must be followed with either a 0 or 1.

I cannot reproduce any problem here (with Windows 7) using /C0 and/or /C1.
However, this command is completely dependent on your keyboard driver; TCC
simply calls a Windows API to set the value.

(KEYBD is also an obsolete command left over from Win95 days; I seriously
doubt anybody is using it for any new batch files. If they are, they should
rethink their logic.)

Rex Conn
JP Software
 
#4
rconn wrote:
| (KEYBD is also an obsolete command left over from Win95 days; I seriously
| doubt anybody is using it for any new batch files. If they are, they
| should rethink their logic.)

I use it to initialize my keyboard to support such things as Vince's DLL
that allows alt-left and alt-right to slide the TCC window to see into a
buffer wider than the window. I also use it when I start a specific legacy
application which uses ScrollLk to control the interpretation of the left
and right arrow keys.

Is there a "more modern" alternate?
--
Steve
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#5
> Is there a "more modern" alternate?
A "modern" alternative is not to assume that you're running a singletasking
OS. If you have a special case where you need to (unknowingly) clobber the
keyboard settings of all your other apps, fine -- but I'm not going to help
you hold the gun to your head. :-)

Rex Conn
JP Software
 
#6
rconn wrote:
| Quote:
| > Is there a "more modern" alternate?
|
| A "modern" alternative is not to assume that you're running a
| singletasking
| OS. If you have a special case where you need to (unknowingly)
| clobber the
| keyboard settings of all your other apps, fine -- but I'm not going
| to help
| you hold the gun to your head. :-)

There is a vast difference betweeen a single-user and a single-tasking
system. When I attend one of my computers, nobody else can get near them.
One keyboard -> single control.

AFAIK Windows does not support keyboard controls on a per process basis. I
cannot have one MS-Word instance in "Insert" mode, while another instance
(or another application) is in "overtype" mode, no matter how desirable that
could be at a given instant.

When I start a specific application from TCC, I often adjust screen
resolution to match what I perceive is most comfortable for me alone when
using that application. It may drive my son crazy, but I am in charge.
Likewise, it is often convenient to set up initial conditions of the "lock"
toggles appropriately for my usage. TCC is an excellent tool for experts.
Changing one of the lock states manually or doing it programmatically has
the exact sane effect: it is changed for all keyboard users. Why restrict
what one can do programmatically (thus not forgetting to do it) when the
same thing can always be done manually, but less conveniently?
--
Steve
 
#7
On Fri, 22 Jul 2011 16:12:16 -0400, rconn <> wrote:

|A "modern" alternative is not to assume that you're running a singletasking
|OS. If you have a special case where you need to (unknowingly) clobber the
|keyboard settings of all your other apps, fine -- but I'm not going to help
|you hold the gun to your head. :-)

In any given situation, it's not clear whether "KEYBD /C0" or "KEYBD /C1" will
do anything at all; If either does anything at all (and either can toggle in
**either** direction) the effect is computer-wide, affecting all applications
(well, at least Notepad, Word, DevEnv, TextPad, Agent, and all TCC instances).

Here, CapsLock is disabled (a registry key-map). I'd just like a reliable way
to toggle CapsLock globally as if the key were enabled and I pressed it. I
tried programming it but Windows seems flaky. A single simulation of CapsLock
down/up (with SendInput) is as unreliable at the KEYBD command.
 
#8
I haven't had any misbehaviour out of keybd /c0 or keybd /c1.


TCC 12.11.71 x64 Windows 7 [Version 6.1.7600]
TCC Build 71 Windows 7 Build 7600

On Fri, Jul 22, 2011 at 14:17, vefatica <> wrote:


> On Fri, 22 Jul 2011 16:12:16 -0400, rconn <> wrote:
>
> |A "modern" alternative is not to assume that you're running a
> singletasking
> |OS. If you have a special case where you need to (unknowingly) clobber
> the
> |keyboard settings of all your other apps, fine -- but I'm not going to
> help
> |you hold the gun to your head. :-)
>
> In any given situation, it's not clear whether "KEYBD /C0" or "KEYBD /C1"
> will
> do anything at all; If either does anything at all (and either can toggle
> in
> **either** direction) the effect is computer-wide, affecting all
> applications
> (well, at least Notepad, Word, DevEnv, TextPad, Agent, and all TCC
> instances).
>
> Here, CapsLock is disabled (a registry key-map). I'd just like a reliable
> way
> to toggle CapsLock globally as if the key were enabled and I pressed it. I
> tried programming it but Windows seems flaky. A single simulation of
> CapsLock
> down/up (with SendInput) is as unreliable at the KEYBD command.
>
>
>
>
>


--
Jim Cook
2011 Monday: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Tuesday.
 
#9
On Fri, 22 Jul 2011 17:50:05 -0400, Jim Cook <> wrote:

|I haven't had any misbehaviour out of keybd /c0 or keybd /c1.

Can you toggle several times in a row "keybd /c1" ... "keybd /c0" ...
"keybd /c1" ... "keybd /c0" ...

If I "keybd /c1" the light comas on and I'm typing in caps. If I then
"keybd /c0" nothing happens and I'm still typing in caps. OTOH if I "keybd /c1"
twice, it actually toggles, on then off.
 
#11
On Fri, 22 Jul 2011 22:19:54 -0400, David Marcus <> wrote:

|---Quote (Originally by vefatica)---
|Can you toggle several times in a row "keybd /c1" ... "keybd /c0" ... "keybd /c1" ... "keybd /c0" ...
|---End Quote---
|Yes.

I very definitely cannot. Below, I did not press the shift key at all. C1
turns it on; C0 fails to turn it off; thereafter, C1 turns it off, C0 turns it
on.

Code:
v:\> keybd /c1

v:\> KEYBD /C0

v:\> KEYBD /C1

v:\> keybd /c0

v:\> KEYBD /C1

v:\> keybd /c0

v:\> KEYBD /C1

v:\> keybd /c0
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#12
> |I haven't had any misbehaviour out of keybd /c0 or keybd /c1.
>
> Can you toggle several times in a row "keybd /c1" ... "keybd /c0" ...
> "keybd /c1" ... "keybd /c0" ...
Yes, no problems.

You might try replacing/updating your keyboard driver.

If you're trying to use SendInput, try increasing the delay between the down
& up.

Rex Conn
JP Software
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#13
> Why restrict what one can do programmatically (thus not forgetting
> to do it) when the same thing can always be done manually, but less
> conveniently?
Two words -- "support nightmare".

Right now, one person is having one problem after 15 years, because of
something he deliberately did (setting caps lock) that affected every
process in Windows. (A well-documented Windows "feature".)

What you want me to do is affect EVERYBODY by toggling their keyboard state,
unbeknownst to them. Feel free to hack your own system, but there is
absolutely, positively, no way I am going to do that in TCC. (End of
thread!)

Rex Conn
JP Software
 
#14
On Fri, 22 Jul 2011 23:10:22 -0400, rconn <> wrote:

|You might try replacing/updating your keyboard driver.
|
|If you're trying to use SendInput, try increasing the delay between the down
|& up.

How do I replace a keyboard driver (and replace it with what)? I use (old)
Gateway 2000 AnyKey keyboards.

I got SendInput working reliably; I was initializing the INPUTs incorrectly. I
can toggle CapsLock on/off perfectly. But (maybe of interest) GetKeyboardState
does not show such a change right away.
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#15
> I very definitely cannot. Below, I did not press the shift key at all.
C1

> turns it on; C0 fails to turn it off; thereafter, C1 turns it off, C0
turns it

And yet, you persist in running a 10-year-old version of Windows as though
it possessed some inherent virtue ... :-)

Rex Conn
JP Software
 
Jun 7, 2008
96
3
#16
On Sat, Jul 23, 2011 at 12:00 AM, rconn <> wrote:


> And yet, you persist in running a 10-year-old version of Windows as though
> it possessed some inherent virtue ... :-)
I know a couple of die-hards still running Win98.

The "inherent virtue" in one case is "It runs on ancient hardware that
won't run a newer version of Windows, I don't want to spend the money
on newer hardware, and this does what I want." In fact, he usually
doesn't run 98, unless he absolutely *must* use a GUI app like a web
browser. He normally runs MS-DOS with DesqView/X, and uses 4DOS as
his command processor. He runs an open source package called KernelEx
from http://kernelex.sourceforge.net/ that adds enough of the 32 bit
Windows infrastructure that things like Opera 11.50 will run on Win98.

I'm not sure what the other chap's motive is. He also claims FAT32 is
superior to NTFS, so his grasp of reality is questionable...

I still run XP because the desktop was a 32 bit machine until a recent
CPU swap, and the only thing Vista/Win7 offers that I could really use
is support for true symbolic links in NTFS5. (I make extensive use of
hard links.)


> Rex Conn
> JP Software
______
Dennis
 
#17
Mine works exactly as expected. c0 becomes off, c1 becomes on.

On Fri, Jul 22, 2011 at 19:51, vefatica <> wrote:


> On Fri, 22 Jul 2011 22:19:54 -0400, David Marcus <> wrote:
>
> |---Quote (Originally by vefatica)---
> |Can you toggle several times in a row "keybd /c1" ... "keybd /c0" ...
> "keybd /c1" ... "keybd /c0" ...
> |---End Quote---
> |Yes.
>
> I very definitely cannot. Below, I did not press the shift key at all. C1
> turns it on; C0 fails to turn it off; thereafter, C1 turns it off, C0 turns
> it
> on.
>
>
> Code:
> ---------
> v:\> keybd /c1
>
> v:\> KEYBD /C0
>
> v:\> KEYBD /C1
>
> v:\> keybd /c0
>
> v:\> KEYBD /C1
>
> v:\> keybd /c0
>
> v:\> KEYBD /C1
>
> v:\> keybd /c0
> ---------
>
>
>
>


--
Jim Cook
2011 Monday: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Tuesday.
 
#18
rconn wrote:
| And yet, you persist in running a 10-year-old version of Windows as
| though it possessed some inherent virtue ... :-)

It does possess these inherent virtues for me:
1/ bought and paid for
2/ performs 100% of what I need and 99% of what I'd like.
3/ later versions dropped access to my legacy software even though the
hardware supports it

BTW, this is probably going to be posted much later than "sent" due to the
regular failure of the internet service at Lorien Columbia Health Care
Center.
--
Steve
 
Jun 7, 2008
96
3
#19
On Sun, Jul 24, 2011 at 1:11 PM, Steve Fabian <> wrote:

> rconn wrote:
> | And yet, you persist in running a 10-year-old version of Windows as
> | though it possessed some inherent virtue ... :-)
>
> It does possess these inherent virtues for me:
> 1/ bought and paid for
> 2/ performs 100% of what I need and 99% of what I'd like.
> 3/ later versions dropped access to my legacy software even though the
> hardware supports it
Which version of Windows do you run, and what legacy software do you refer to?


______
Dennis
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#21
> It does possess these inherent virtues for me:
> 1/ bought and paid for
> 2/ performs 100% of what I need and 99% of what I'd like.
> 3/ later versions dropped access to my legacy software even though
> the hardware supports it
#2 is probably a lot less than 100%/99%, particularly since you obviously
crave symlinks, which don't exist in XP.

#3 isn't true -- Win7 has a built-in XP VM that'll run anything that runs in
native XP.

You might want to add the attendant XP flaws:

4) Microsoft is dropping support for XP soon.

5) XP is slow, slow, slow.

6) XP is buggy, buggy, buggy.

7) XP is ugly, ugly, ugly ...

8) You're going to be locked into your current software revisions, as the
developers switch over to Win7+ versions.

9) You're getting left further behind all the time.

So your only valid point is #1, which IMO is overwhelmed by the rest.

Rex Conn
JP Software
 
Jun 7, 2008
96
3
#22
On Sun, Jul 24, 2011 at 3:05 PM, Steve Fabian <> wrote:

> | Which version of Windows do you run, and what legacy software do you
> | refer to?
>
> WinXP SP3 - Pro (laptop), home (desktop)
>
> The most frequently used legacy software: BRIEF, Lotus Magellan 2.0
> (rarely), Windows entertainment pack.
I run XP Pro SP3 here. (Until a recent CPU upgrade, it was a 32bit
system, and no point to running anything beyond XP.) I don't use
BRIEF (though I have an assortment of editors that emulate it) nor
Magellan, though I do have an assortment of the old Windows games
installed.

Windows on the newer 64bit systems doesn't support 16 bit MS-DOS
applications, unless I want to resort to a virtual machine. For
instance, I still use Eric Meyer's VDE editor. It works fine in an
NTVDM session under XP. For that matter, it works in Linux if I
install DOSBox, which is a specialized VM intended to run old DOS
games. (The drawback is that DOSBox thinks of the screen in terms of
graphics resolution. There doesn't seem to be a way in text mode to
do other than 80x25.) DOSBox has a Windows port too, and may be an
alternative for folks on 64 bit Vista/Win7 platforms that *must* have
dome legacy 16 bit apps.

The SO's laptop is a 64 bit box. She lost the legacy DOS app she used
to manage her recipe database, but there are things that do run that
could import her data. She also lost the DOS port of a Unix game we
both play, but I found a 32bit update that would run, so she's happy.


______
Dennis
 
#23
On Sun, 24 Jul 2011 15:27:55 -0400, rconn <> wrote:

|#3 isn't true -- Win7 has a built-in XP VM that'll run anything that runs in
|native XP.

Will it allow a service to run that way? One reason I don't upgrade is the
stated inability for a service to interact with the user desktop.
 
#24
On Sun, 24 Jul 2011 15:27:55 -0400, rconn <> wrote:

|7) XP is ugly, ugly, ugly ...

Do you mean visually? I've been looking at the same desktop for about 15 years
(classic task bar and 0,100,100 background). I'll want that from Win7.
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#27
> Do you expect to convince Steve or Vince?
Neither.

Steve was about the last 4DOS / Win98 holdout here, and was inconsolable
when I dropped 4DOS (two years after Microsoft dropped Win98 support!). Now
he's similarly stuck on XP, despite a continuing stream of feature requests
from him that require a newer version of Windows to implement. Vince keeps
saying "I can't upgrade unless it can this". It can do that. "How about
that?" It can do that too. "Well, I don't care, I'm not going to upgrade
anyway. My current system is ... well ... badly fractured, and prone to
dozens of nonreproducible errors, but I like it just fine that way."

I'm just baffled when people say "I don't care how good that new version is,
I'm going to stick with my good old broken abacus. Don't need no newfangled
electrons." :-)

I suspect the only way to move the hardliners over is when I drop support
for XP when Microsoft does.

Rex Conn
JP Software
 

rconn

Administrator
Staff member
May 14, 2008
10,494
94
#28
> Will it allow a service to run that way? One reason I don't
> upgrade is the stated inability for a service to interact with
> the user desktop.
I don't know what you're after. You want a service running in the XP VM to
interact with the Windows 7 desktop? (That would admittedly be a good
trick, but I can't imagine how it would be needed.)

Rex Conn
JP Software
 
#29
On Sun, 24 Jul 2011 17:14:45 -0400, DMcCunney <> wrote:

|On Sun, Jul 24, 2011 at 4:40 PM, vefatica <> wrote:
|
|
|---Quote---
|> On Sun, 24 Jul 2011 15:27:55 -0400, rconn <> wrote:
|>
|> |7) XP is ugly, ugly, ugly ...
|>
|> Do you mean visually? *I've been looking at the same desktop for about 15 years
|> (classic task bar and 0,100,100 background). *I'll want that from Win7.
|---End Quote---
|Look at http://classicshell.sourceforge.net/index.html

I sure as heck won't go to third party software to make Windows look the way I
want it to.