Solved

Can I change the default beep sound?

Posted on 1997-12-26
9
235 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
 
LVL 4

Expert Comment

by:rantanen
ID: 1447498
Do you have a soundcard installed?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now