1. Keycode problem

The utility "key.bat" reports the code for downkey to be 336, and the 
code for ctrl downkey to be 401. Debugging with trace shows the returned 
code to be 336, regardless of whether ctrl is pressed or not.
The same is true for alt downkey. What am I missing?

Allen

new topic     » topic index » view message » categorize

2. Re: Keycode problem

Allen wrote:

> The utility "key.bat" reports the code for downkey to be 336, and the
> code for ctrl downkey to be 401.

"key.bat" runs the program "key.ex". I'm getting the same results here
on Windows 98.

> Debugging with trace shows the returned code to be 336, regardless of
> whether ctrl is pressed or not. The same is true for alt downkey. What
> am I missing?

What is the exact code that you use for debugging with trace? Did you
insert the trace commands into the program "key.ex"?

Regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |    |\      _,,,---,,_
 \ /  against HTML in       |    /,`.-'`'    -.  ;-;;,_
  X   e-mail and news,      |   |,4-  ) )-,_..;\ (  `'-'
 / \  and unneeded MIME     |  '---''(_/--'  `-'\_)

new topic     » goto parent     » topic index » view message » categorize

3. Re: Keycode problem

In my "Extras routines" routine there is a "h_bios.e" library,
wich you can use to catch "ctrl" & "alt" keys accuratly.
----- Original Message ----- 
From: "Allen Robnett" <alrobnett at alumni.princeton.edu>
To: <EUforum at topica.com>
Subject: Keycode problem


> 
> 
> The utility "key.bat" reports the code for downkey to be 336, and the 
> code for ctrl downkey to be 401. Debugging with trace shows the returned 
> code to be 336, regardless of whether ctrl is pressed or not.
> The same is true for alt downkey. What am I missing?
> 
> Allen
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 
> 
> -- 
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.558 / Virus Database: 350 - Release Date: 4/01/04
> 


---


--

new topic     » goto parent     » topic index » view message » categorize

4. Re: Keycode problem

Sorry, I didn't make it clear. With key.bat, I get the code 401 for ctrl 
downkey. In the program that I am creating, x=wait_key() yields 336 for 
downkey, for ctrl downkey and for alt downkey. In other words, key.bat 
performs as expected, my program, running on Windows 98 does not. Allen 
wrote:

>> The utility "key.bat" reports the code for downkey to be 336, and the
>> code for ctrl downkey to be 401.
>  
>

"key.bat" runs the program "key.ex". I'm getting the same results here
on Windows 98.


>> Debugging with trace shows the returned code to be 336, regardless of
>> whether ctrl is pressed or not. The same is true for alt downkey. What
>> am I missing?
>  
>

What is the exact code that you use for debugging with trace? Did you
insert the trace commands into the program "key.ex"?

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

5. Re: Keycode problem

Allen wrote:

> Sorry, I didn't make it clear. With key.bat, I get the code 401 for ctrl
> downkey. In the program that I am creating, x=wait_key() yields 336 for
> downkey, for ctrl downkey and for alt downkey. In other words, key.bat
> performs as expected, my program, running on Windows 98 does not.

"key.bat" runs the program "key.ex". That program uses the built-in
function get_key() to get the keycodes, while you use wait_key() for
this purpose. But this should not cause the problem, since as far as I
know get_key() and wait_key() return the same keycodes.

Let me guess: Your program is a Windows application (say "myprog.exw"),
right? "key.ex" is a DOS program. If you rename your program to say
"myprog.ex", then it is a DOS program and will probably work as expected
(a least regarding the point in discussion here).

I just realized, that wait_key() (as well as get_key()) in some cases
returns different key codes, depending whether the program runs on DOS
or Windows (what about Linux?).

So this might be the explanation, but not the solution. I think a
Windeows application must use a differnt way to get the desired
information. I'm sure someone else here knows how to do so.

[snipped old text]

Regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |    |\      _,,,---,,_
 \ /  against HTML in       |    /,`.-'`'    -.  ;-;;,_
  X   e-mail and news,      |   |,4-  ) )-,_..;\ (  `'-'
 / \  and unneeded MIME     |  '---''(_/--'  `-'\_)

new topic     » goto parent     » topic index » view message » categorize

6. Re: Keycode problem

On Fri, 09 Jan 2004 18:34:11 -0600, Allen Robnett
<alrobnett at alumni.princeton.edu> wrote:

>Sorry, I didn't make it clear. With key.bat, I get the code 401 for ctrl 
>downkey. In the program that I am creating, x=wait_key() yields 336 for 
>downkey, for ctrl downkey and for alt downkey. In other words, key.bat 
>performs as expected, my program, running on Windows 98 does not.

Looks like a bug in exw.exe.. Rob?

Allen, since I believe you are writing a dos program, make sure the
program is run with ex.exe not exw.exe. It may be enough to change the
extension on the source file you are writing.

Pete

new topic     » goto parent     » topic index » view message » categorize

7. Re: Keycode problem

Thanks for all the help.
Pete nailed it. Changing the extension from exw to ex solved the 
problem. I halfway understand why. I have never concerned myself with 
the fine points of the differences between DOS and Windows. I think I 
assumed that if I designated the program as exw then all of the more 
sophisticated tricks would be more likely to work. In the early DOS days 
(the last time I played with programming) I remember having to capture 
two bytes to interpret uncommon key strokes.

Allen

new topic     » goto parent     » topic index » view message » categorize

8. Re: Keycode problem

Pete Lomax wrote:
> On Fri, 09 Jan 2004 18:34:11 -0600, Allen Robnett
> <alrobnett at alumni.princeton.edu> wrote:
> 
> 
>>Sorry, I didn't make it clear. With key.bat, I get the code 401 for ctrl 
>>downkey. In the program that I am creating, x=wait_key() yields 336 for 
>>downkey, for ctrl downkey and for alt downkey. In other words, key.bat 
>>performs as expected, my program, running on Windows 98 does not.
> 
> 
> Looks like a bug in exw.exe.. Rob?
> 
> Allen, since I believe you are writing a dos program, make sure the
> program is run with ex.exe not exw.exe. It may be enough to change the
> extension on the source file you are writing.

The key codes for the special keys are a bit different
between DOS, Windows, Linux and FreeBSD. I don't know exactly why.
It's not a bug in Euphoria. It happens at a lower level.

Regards,
    Rob Craig
    Rapid Deployment Software
    http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu