Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

Beep Substitute

How do I make a click sound in VB, in place of the Beep
0
lewiss
Asked:
lewiss
1 Solution
 
MikeP090797Commented:
You can use sndPlaySound API to play any .wav file. Since you haven't specified VB version you are using, you will have to get the declaration from Api text viewerv, located at \VB\Winapi
0
 
lewissAuthor Commented:
How do I call it in VB5?  
0
 
TheAnswerManCommented:
PUT THIS WITH YOUR GLOBALS>>>
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long


THEN>>> when you want to play the sound...
call sndPlaySound("C:\PathName.wav",0)
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
viktornetCommented:
MessageBeep(mb_Ok);

//Vik
0
 
lewissAuthor Commented:
I'm sorry, but I don't want to play a WAV file.  I want an
audible "click" or some short pleasant sound to replace the
beep.
0
 
viktornetCommented:
Public Declare function MessageBeep Lib "user32.dll"(ByVal uType As Long) as Boolean

const MB_ICONASTERISK = 64
const MB_ICONEXCLAMATION = 48
const MB_ICONHAND = 16
const MB_ICONQUESTION = 32
const MB_OK = 0

YOu can call any of those sounds as follows...

call MessageBeep(MB_ICONHAND)

That's all..hope you enjoy it...

Regards,
Viktor Ivanov
0
 
lewissAuthor Commented:
I only get beeps and clunks from the constants given for the messagebeep routine.  Useful information but not what I was hoping for.  Thanks for the effort.


0
 
viktornetCommented:
There are some other constant sounds in Windows so try searching for them, and find out what the constants for those sounds are do you can play it... There is also a click but I don't temember the constant for that sound....try searching for 'em...

Regards,
Viktor Ivanov
0
 
lewissAuthor Commented:
Is there any way that I can sub-class the beep function? I've
tried entering various values but keep getting the standard
beep.

Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

0
 
viktornetCommented:
You want to use Bepp() instead of MessageBeep() ????
0
 
lewissAuthor Commented:
What is Bepp()? It's not in the api list.  How would you use
it?
0
 
viktornetCommented:
Sorry..... I meant Beep()
0
 
lewissAuthor Commented:
Yes. How do I subclass it?  
0
 
viktornetCommented:
I'm not sure but what do you mean by subclass it??? I'm not exactly a VB programmer so I don't know the term you've used.

Regards,
Viktor Ivanov
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now