| View previous topic :: View next topic |
| Author |
Message |
erasmus Newbie

Joined: 07 Aug 2002 Posts: 3
|
Posted: Wed Aug 07, 2002 7:55 pm Post subject: Problem: Recognize and change the state of Caps-Lock |
|
|
Hi There,
I've been pulling my hair out because of this little problem.
In my script, I need to enter data into a dialog, so I've been
using WINDOW SEND, but, if the user who runs my script has
Caps-Lock on, it will change the state of what my script enters
into the dialog.
Ideally what I am looking for is some code to detect the
state of Caps-Lock and then toggle Caps-Lock to lower-case,
although I can get by with just the state detection.
I've looked into scan codes, but I haven't thought of a good
method to implement them.
Thanks for the help,
erasmus |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Aug 07, 2002 11:14 pm Post subject: |
|
|
VDS by itself does not have this ability. It would require the use of a dll. I had a dll made for me once that allowed me to do this, but I can't remember at this time if the rights to the dll were mine or the programmer who made it, so I'll have to ask whether the dll can be distributed.
-Garrett |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Aug 08, 2002 12:00 am Post subject: |
|
|
Ok, seems distribution is up to me on the dll, so let me get some documentation together on it and get it uploaded to the VDSWorld site.
If I remember correctly, there was only one drawback to this dll, and that is that your program has to be the active program in order for the dll to report the status of the key and to be able to activate or deactivate the key.
-Garrett |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
|
| Back to top |
|
 |
erasmus Newbie

Joined: 07 Aug 2002 Posts: 3
|
Posted: Thu Aug 08, 2002 2:16 pm Post subject: |
|
|
Thanks Garrett,
I didn't think that it would be this complicated, but this
will certainly help. File mangle? Sounds like an interesting
feature if I ever heard of one. Please send my thanks to the
author. ;)
Thanks again,
erasmus |
|
| Back to top |
|
 |
VDSuser Contributor


Joined: 21 Mar 2002 Posts: 58 Location: Somewhere in time
|
Posted: Thu Aug 08, 2002 5:09 pm Post subject: |
|
|
| This is good. Very good. Now only if there was a way to check the keystates of a remote PC on a network! |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Aug 08, 2002 6:03 pm Post subject: |
|
|
I'm sure the programmer has already received your thanks.
-Garrett |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Thu Aug 08, 2002 7:34 pm Post subject: |
|
|
This is VERY nice. Very handy indeed.  |
|
| Back to top |
|
 |
erasmus Newbie

Joined: 07 Aug 2002 Posts: 3
|
Posted: Fri Aug 09, 2002 2:24 pm Post subject: |
|
|
Well, as to the network problem, there could be a solution.
All you want to do is ensure the Caps-Lock is off, right?
Depending on the OS, perhaps one could put a VDS script in
the bootup of the OS, which checks the status of the key
and turns it off every 0.1 seconds.
There may be a problem for a remote operator to change the
Caps-Lock (protection issues), but to run a program locally
it could be done.
On our network, the support staff can control terminals remotely,
(once they have the user's permission) so it wouldn't be much of
an issue to run the program once they have control.
To report the status, it would be easy on a Unix system to send
an email or a message from the target computer, once the program
is run. Perhaps that method could be implemented on a
Windows machine, and since we are talking about VDS, Unix doesn't
really come into play.
Just kicking around a few ideas,
erasmus |
|
| Back to top |
|
 |
VDSuser Contributor


Joined: 21 Mar 2002 Posts: 58 Location: Somewhere in time
|
Posted: Fri Aug 09, 2002 8:07 pm Post subject: |
|
|
Running a program on a remote PC is a good suggestion, but not feasable in our environment. If such a program were to be run, it could update a registry value whenever the keystate changed. Polling the registry value would then return the state of the remote PC.
I'd like to see the more direct way: inspect the memory. In BASIC it's done with the code DEF SEG = 0:X = PEEK(1047) AND 64. If X equals zero, the Caps Lock is off. If X is 64, the Caps Lock is on. To force the Caps Lock state to off, use POKE 1047, PEEK(1047) AND 191 after the DEF SEG statement or, to turn it on, use POKE 1047, PEEK(1047) OR 64.
A good program will read the key state, change the state to perform with the program, then change it back.
Can any of our viewers write a DLL to allow this? |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Aug 10, 2002 3:37 am Post subject: |
|
|
Ahhhh..... Good old PEEK and POKE... Haven't seen those in a long time.
-Garrett |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Aug 10, 2002 4:29 am Post subject: |
|
|
Correct me if I am wrong but PEEK and POKE is a 16 bit function and cannot really be performed in a 32bit environment without thunking memory? In other words one would probally have to write a device driver that would perform this? I know of only one DLL currently on the market that does this and it is pretty expensive. Also it is written in C and acts as a bridge but it is not a VDS dll.
I don't really understand what you guys are tring to accomplish here but it sounds like you want a way to access a remote PC's memory to change the state of a keyboard key but not hold a file on the remote PC. The only way I know to do this is through SMNP which stands for (Simple Management Network Protocol). This will take some time to do but I may tackle it if I can. Despite it's name it is far from simple in windows. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Aug 10, 2002 10:05 am Post subject: |
|
|
| I remember having to use thunking when I used LB 1.x. We needed to thunk in order to get to the 32 bit api calls since LB 1.x was 16 bit. Just doing that was sometimes a task and a half. |
|
| Back to top |
|
 |
|