Solved

Can I change the default beep sound?

Posted on 1997-12-26
9
243 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

832 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