Hi SheepDog, if you've got it, that's where it'll be. Trouble is, I've got Access, Visual Basic 6, and Delphi 7 on my machine, so I don't know what controls come with what, I think it comes with Visual Basic 6.
However, you may be able to download it from somewhere.
There are two ways to write error-free programs; only the third one works.
I did what you suggested above and it is all set to work. My only problem is that when I went to the form and went into the toolbox to select it, I get an error message stating that I need to obtain the license in order to use it.
Taking this question 1 step further I would need to do the same except i would like to add several buttons to a form and attach a clip to each one but i want the f1-F12 keys to activate the buttons
miletracker
ps sorry for interupting
Applogies, it would appear that you need to have one of the packages installed that this component ships with (includes VB6 C++ not sure if there are any others). Been having a look around and can't find a way around this.
So it would appear that this is only a solution if you have this control already.
miletracker,
Example of code to run when function keys are pressed (so put your choice of sound playing code in each select...)
'In order for this to work you must set
'KeyPreview = Yes on form
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'Detect Function Key Pressed and
Select Case KeyCode
Case Is = vbKeyF1
'do f1 stuff here
Case Is = vbKeyF2
'do f2 stuff here
Case Is = vbKeyF3
'do f3 stuff here
End Select
'Cancel default key behaviour
KeyCode = 0
End Sub
There are two ways to write error-free programs; only the third one works.
Once you've declared the function only one line of code anywhere to play sounds.
(only drawback is that it'll only play wav files )
Put the following code in a module...
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Sub gPlaySound(ByVal vstrFileName As String, ByVal vbooWait As Boolean)
Dim lng As Long
Dim intFlag As Integer
If vbooWait Then
intFlag = 0
Else
intFlag = 1
End If
lng = sndPlaySound(vstrFileName, intFlag)
End Sub
You can call this from anywhere with...
gPlaySound "<filepath>", True/False
Setting the second parameter to True will ensure that the sound will be completely played before any additional sounds that are sent.
Setting it to False will mean that any new sound sent will start immediately (cutting out any already playing).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.