-
I know enough just to be dangerous.
I have never been on this forum before and was impressed with some of the answers I saw posted.
detecting a keypress and keydown and keyup on a form or a control is relatively. What I would like to do is use the keydown and keyup clicks to start and stop a tone played through the computers speakers.
Depending on the key pressed, I want to be able to change the tone's frequency (ie sound). I am not trying to create a "musical keyboard" but I would like the programs user to have a general idea of where in the form he/she is and what they are doing.
In addition, is there a way to control the "length" of the tone? for example, one keypress could trigger a short tone while another could trigger a longer.
Thanking you in advance
-
You can use the Beep API function, but it only work for WinNT/Win2K platform
Code:
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Command1_Click()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
' Attempt to play a note at 800 Hz for 2 seconds. This will only
' behave this way on Windows NT/2000; users of Windows 95/98 will only hear the
' default sound.
Dim retval As Long ' return value
retval = Beep(800, 2000) ' ideally, an 800 Hz tone for 2 seconds
End Sub
-
Thanks Chris...but unfortunately, almost all of the computers this will be running on are running Win 98 and there is a better chance of getting ice water in H$#@ before they will upgrade within the next 12 months.