Alt+anykey help...heres an example and ideas? 
Author Message
 Alt+anykey help...heres an example and ideas?

Hello!

    A few days ago I asked about how to make Alt+anykey do something
specific I want. Here is an example of what I want it to do. I've messed
around with the code, but I can't get it to work when I try and input it
into the program I want it in! If someone could look at it and tell me what
code I actually need, or show me the sytax of another way I can do it, it
would be greatly appreciated: I don't want it to repeat or anything. Just so
that if someone presses Alt+F1 or Alt+Fwhatever it will perform something
specific.

    Heres the sample example I found. What code do I need to put into my
program I want it in?

Uses Crt;
var ch: char;

begin
TextMode (co80);
TextColor (15);
TextBackGround (1);
ClrScr;
WriteLn ('Press ESC to quit!');
Repeat

ch := ReadKey;

 If ch = #0 Then
    Begin

     Ch := readKey;

       If ch = #104 Then WriteLn ('Alt+F1');
       If ch = #105 Then WriteLn ('Alt+F2');
       If ch = #106 Then WriteLn ('Alt+F3');
       If ch = #107 Then WriteLn ('Alt+F4');
       If ch = #108 Then WriteLn ('Alt+F5');
       If ch = #109 Then WriteLn ('Alt+F6');
       If ch = #110 Then WriteLn ('Alt+F7');
       If ch = #111 Then WriteLn ('Alt+F8');
       If ch = #112 Then WriteLn ('Alt+F9');
       If ch = #113 Then WriteLn ('Alt+F10');

       ch := #0;

    End;

 If (ch <>#0) and (ch <> #8) and (ch <> #13) and (ch <> #32) Then WriteLn
(ch);
Until ch = #27;  {Esc pressed?}
 WriteLn ('Esc');
end.

    Thanks!!!

    :) Evan Anderson



Wed, 18 Jun 1902 08:00:00 GMT  
 Alt+anykey help...heres an example and ideas?

Quote:

>Hello!

>    A few days ago I asked about how to make Alt+anykey do something
>specific I want. Here is an example of what I want it to do. I've messed
>around with the code, but I can't get it to work when I try and input it
>into the program I want it in! If someone could look at it and tell me what
>code I actually need, or show me the sytax of another way I can do it, it
>would be greatly appreciated: I don't want it to repeat or anything. Just
so
>that if someone presses Alt+F1 or Alt+Fwhatever it will perform something
>specific.

>    Heres the sample example I found. What code do I need to put into my
>program I want it in?

>Uses Crt;
>var ch: char;

>begin
>TextMode (co80);
>TextColor (15);
>TextBackGround (1);
>ClrScr;
>WriteLn ('Press ESC to quit!');
>Repeat

>ch := ReadKey;

> If ch = #0 Then
>    Begin

>     Ch := readKey;

>       If ch = #104 Then WriteLn ('Alt+F1');
>       If ch = #105 Then WriteLn ('Alt+F2');
>       If ch = #106 Then WriteLn ('Alt+F3');
>       If ch = #107 Then WriteLn ('Alt+F4');
>       If ch = #108 Then WriteLn ('Alt+F5');
>       If ch = #109 Then WriteLn ('Alt+F6');
>       If ch = #110 Then WriteLn ('Alt+F7');
>       If ch = #111 Then WriteLn ('Alt+F8');
>       If ch = #112 Then WriteLn ('Alt+F9');
>       If ch = #113 Then WriteLn ('Alt+F10');

>       ch := #0;

>    End;

> If (ch <>#0) and (ch <> #8) and (ch <> #13) and (ch <> #32) Then WriteLn
>(ch);
>Until ch = #27;  {Esc pressed?}
> WriteLn ('Esc');
>end.

>    Thanks!!!

>    :) Evan Anderson

Evan,

To get this program to do something useful you change
(as an example) the line
If ch = #104 Then WriteLn ('Alt+F1');
to something like
If ch = #104 Then DoSomethingUseful;
Where DoSomethingUseful is your own Procedure.

In order to be successful at writing a useful program you
must acquire a good understanding of what each line of
code does. Just copying somebody's code and lopping
off pieces at random will never work.

KlausL



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ALT & ALT-GR key

2. Figured out my Alt+anykey problem...but what about billions of numbers?

3. help with alt-ctrl keys

4. Need Help Trapping Ctrl-Alt-Del

5. Delphi BDE and QBE example (IE: Using Query By Example instead of SQL)

6. Heres one more

7. heres a quickie

8. forward command - heres the sample of what I ment

9. sorry..heres my address....:-)

10. Help with school project (I need ideas)

11. Ideas and help

12. Out of Database ideas ----- HELP

 

 
Powered by phpBB® Forum Software