Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Arbitrary start/end beep
Message
From
18/04/2003 06:58:45
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00779104
Message ID:
00779109
Views:
15

>Hi All.
>As a leisure time project my son and i would like to develope a small application which would help us learn to Morse code (we are talking radio here).
>I am looking for a function to start/end the beep. The one that i know takes duration and frequency as parameters. In this case i don't know the duration. I want to press a key - start beeping, release a key - end beeping.
>Another accompanying question: There are MouseDown/Up events on a form but no KeyDown/Up. Is it possible in VFP7 to intersept KeyDown/Up events.
>
>Best wishes.
>Kamil


Kamil,

1) I would put the beep function in a DO WHILE...ENDDO loop and the condition would be while a key was being pressed. i.e.:
FUNCTION BeepSound

  Parameter nKeyCode

  DO WHILE INKEY() = nKeyCode && Loop while the required key is being pressed
    ?? CHR(7)  && Beep
  ENDDO

ENDFUNC

2) For the second part of your question look at the forms KEYPRESS event. It gets a parameter, nKeyCode, and in this event you could call your beep function with the nKeyCode value. Then loop for as long the key continues to be pressed.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform