Solved

Can I change the default beep sound?

Posted on 1997-12-26
9
244 Views
Last Modified: 2008-03-04
I am using VB4/32 and want to change the default beep sound.
I tried using the API reference, but all the beeps still sound the same.

Thanks,
Don
0
Comment
Question by:deross
  • 5
  • 3
9 Comments
 
LVL 4

Expert Comment

by:rantanen
ID: 1447495
You use MessageBeep API as follows (VB5/Win95):

Put following declarations in a forms general section

Private Declare Function MessageBeep Lib "user32" (ByVal wType As Long) As Long
Const MB_OK = &H0&
Const MB_ICONASTERISK = &H40&
Const MB_ICONEXCLAMATION = &H30&
Const MB_ICONHAND = &H10&
Const MB_ICONQUESTION = &H20&
Const INTERNAL_SPEAKER = -1

and add implied controls and following code

Private Sub Command1_Click()
    Dim lResult As Long
   
    Select Case List1.List(List1.ListIndex)
        Case "MB_OK"
            lResult = MessageBeep(MB_OK)
        Case "MB_ICONASTERISK"
            lResult = MessageBeep(MB_ICONASTERISK)
        Case "MB_ICONEXCLAMATION"
            lResult = MessageBeep(MB_ICONEXCLAMATION)
        Case "MB_ICONHAND"
            lResult = MessageBeep(MB_ICONHAND)
        Case "MB_ICONQUESTION"
            lResult = MessageBeep(MB_ICONQUESTION)
        Case "INTERNAL_SPEAKER"
            lResult = MessageBeep(INTERNAL_SPEAKER)
    End Select
End Sub

Private Sub Form_Load()
    List1.AddItem "MB_OK"
    List1.AddItem "MB_ICONASTERISK"
    List1.AddItem "MB_ICONEXCLAMATION"
    List1.AddItem "MB_ICONHAND"
    List1.AddItem "MB_ICONQUESTION"
    List1.AddItem "INTERNAL_SPEAKER"
End Sub

0
 
LVL 4

Expert Comment

by:rantanen
ID: 1447496
Or did you mean how to change the .wav file assigned as system default sound? If that's the case then I'm sorry I misunderstood your question. I thought you meant how to use MessageBeep API call.
0
 

Author Comment

by:deross
ID: 1447497
Hi rantanen,

I have tried the above suggestion but I still get the same sounding beep for whatever I chose from the list.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 4

Expert Comment

by:rantanen
ID: 1447498
Do you have a soundcard installed?
0
 

Author Comment

by:deross
ID: 1447499
Yes, I have a SoundBlaster Pro.

0
 
LVL 4

Expert Comment

by:rantanen
ID: 1447500
Then in Control Panel -> Sounds, do you have different WAV files assigned to different events? If not, do some changes there.
0
 

Author Comment

by:deross
ID: 1447501
I'm sorry if I mislead you, but I am creating this program for someone who does not have a sound card installed and I want to generate different sounding beeps through their internal speaker.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1447502
This isn't possible under Win95 directly. Microsoft has removed the sound APIs from Win32, and if you want to call them, you must build a separate program in 16bit VB, and use it as a DDE server from your program
0
 
LVL 4

Accepted Solution

by:
rantanen earned 50 total points
ID: 1447503
Sorry that I forgot to get back to you :-(

There is a way to do it. Check out following MS KB article:

How to Install and Use the PC Speaker Driver with Windows 95

Last reviewed: May 1, 1997
Article ID: Q138857 95 WINDOWS kbmm

Following are two excrepts from this article:

"SUMMARY

Speak.exe contains a Microsoft Windows sound driver that allows most .wav files to be played on the PC speaker on most computers not equipped with a sound card. This article describes how to obtain, install, and use the PC speaker driver with Microsoft Windows 95. "

" Internet (anonymous FTP)

      ftp ftp.microsoft.com
      Change to the Softlib/Mslfiles folder.
      Get SPEAK.EXE (size: 22312 bytes) "

Of course the drawback (as far as I know) is that you can play only WAV files, but anyway - you can get "similar " sounds connected to different events as in a computer with sound card.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question