CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Join Date
    Aug 2006
    Posts
    83

    Question Guru challenge (seriously!): beep in Win7 64bit

    Hi gurus,

    I just switched to Win7 Ultimate edition 64bit and now the beep functionality via internal speaker (system speaker on motherboard) does not work anymore.

    The reason is described here (basically M$ trying to clean up their code): http://blogs.msdn.com/b/larryosterma...windows-7.aspx

    I used "Console.Beep(a,b)" to notify me that a process has ended.

    Any ideas how to send some kind of acoustic signal through the internal speaker (any loud noise would do for my purposes).

    Thanks and enjoy cracking that nut...

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Guru challenge (seriously!): beep in Win7 64bit

    Hey Beamer, long time no see

    I am by no means a guru, won't ever be, but I usually do not back down at any challenge...

    Well, as it turns out, there is absolutely no solution to this. The only workaround may be to aquire desktop speakers, or headphones and use the MessageBeep API, or System.Audio to play a sound through the desktop speakers, or headphones.

  3. #3
    Join Date
    Aug 2006
    Posts
    83

    Question Re: Guru challenge (seriously!): beep in Win7 64bit

    Hi Hannes, good to see you too!!!

    I hope your reply will not scare anybody else away from this challenge! What makes you so sure that there is now way? Personally I think that there must be some kind of trick, because the speaker itself is connected and produces sound on boot up.

    I would also be willing to direct all audio signals to the internal speaker as a standard setting if I knew how to do that, hoping that this would redirect my beep to the internal speaker...

  4. #4
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Guru challenge (seriously!): beep in Win7 64bit

    This is a problem I came across too, but I have been able to make sound with the api.
    Although, it is really choppy-poppy on 64 bit systems. On some machines it may not work at all, although I have not seen this.
    The proper audio driver may be important as well, and this is very hard to get right on 64 bit systems, even if the sound seems to work fine, it may not be perfect.

    This is the declaration I use.
    Code:
      Private Declare Function apiBeep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Int32, ByVal dwDuration As Int32) As Int32
    I thought I read that the issue was resolved, but it sounds terrible.
    I actually never checked to see if the sound was re-routed to the external speakers, or if it really invokes the internal speaker.
    For Windows 7, we resolved the issue completely – we moved all the functionality that used to be contained in Beep.Sys into the user mode system sounds agent – now when you call the Beep() API instead of manipulating the 8254 chip the call is re-routed into a user mode agent which actually plays the sounds.
    Try it yourself, and make sure the driver is perfect.
    The driver on CD usually is the best, and make sure the bios setting for integrated audio is toggled correctly.
    Be sure to elevate as administrator, or turn off UAC when installing the driver. Some require the UAC to be off, otherwise it will say it installed correctly, but in reality it did not.

    [EDIT]: this api plays syncronously, so if you call it to quickly it may ignore the call, or cue it up, causing sluggish response until finished.
    Last edited by TT(n); March 18th, 2011 at 09:15 AM.

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Guru challenge (seriously!): beep in Win7 64bit

    This is a good thread. I didn't know about this issue at all. I just have one question though..

    Is all this really really needed just for a beep sound, Just to attract attention to the user? Why not use Something like FlashWindow or such like ? Surely Beep doesn't need gto be so important.

    I am stupid, so I am just trying to get my head around this.

    Hannes

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Guru challenge (seriously!): beep in Win7 64bit

    If I mute my sound, because of something important, it better not BEEP when I get a high-score, or something like that!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Aug 2006
    Posts
    83

    Re: Guru challenge (seriously!): beep in Win7 64bit

    Quote Originally Posted by HanneSThEGreaT View Post
    This is a good thread. I didn't know about this issue at all. I just have one question though..

    Is all this really really needed just for a beep sound, Just to attract attention to the user? Why not use Something like FlashWindow or such like ? Surely Beep doesn't need gto be so important.

    I am stupid, so I am just trying to get my head around this.

    Hannes
    Hannes,

    stupid is only the one who doesn't ask.

    There are several reasons for making this important:
    1. As written in the linked article there is software for disabled people that uses the internal speaker.
    2. What do you do if you don't have an external sound system, but want your software to give acoustic signals (i.e. you have a server and/or no monitor connected)?
    3. In my case I have 2 PCs and #1 is plugged into the sound system while #2 is running my software that crunches numbers for quite a while. When it's finished I hear a beep and don't need to turn on or watch the monitor. I might also be in the next room and don't want to check the progress every few minutes.

    Making more sense now?

  8. #8
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Guru challenge (seriously!): beep in Win7 64bit

    Who doesn't have external speakers today? Unless the hardware is corporate property and no extra/unrequired... (unrequired?) equipment was allowed?

  9. #9
    Join Date
    Aug 2006
    Posts
    83

    Question Re: Guru challenge (seriously!): beep in Win7 64bit

    I don't mean to be rude, but this was meant to be a discussion about how to enable the internal speaker, not whether or not (and why) to have external speakers or needing the internal one. If you are interested in the latter please read either my post or the link in the initial post.

    So any ideas on the original topic?

  10. #10
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Guru challenge (seriously!): beep in Win7 64bit

    Have you tried to replace the Beep.sys file with an xp one?

    I read that you can do this, and two people allegedly had success.
    http://www.windowsreference.com/wind...-to-old-style/

    My windows 7 drive is on the fritz(what a surprise), and I did not have any luck with this method.
    At least it seems to be on the right track inside the device manager.

    I assume you know how to take ownership of a file, but if not it's pretty easy.

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Guru challenge (seriously!): beep in Win7 64bit

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  12. #12
    Join Date
    Aug 2006
    Posts
    83

    Re: Guru challenge (seriously!): beep in Win7 64bit

    What's the point of reposting the link from my initial post???

  13. #13
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Guru challenge (seriously!): beep in Win7 64bit

    Sorry. Missed that in the first post.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  14. #14
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Guru challenge (seriously!): beep in Win7 64bit

    I think this method should work.
    I was getting a message that the driver was blocked.
    However I was not booting from CD as my link described.

    I will try again from BartPE -like CD, and post the results.
    This could resolve it, or squash it.

    The default beep is controlled by a driver under, c:\windows\system32\drivers\beep.sys. Maybe if you switched it out with a driver from XP/Vista it would increase the volume.

    To see this driver you have to open device manager then click on View > Show hidden devices. Then under Non-Plug and Play Drivers you’ll see “Beep.” This is the driver that runs your beep. Right click on it then choose properties and go to the driver tab, then click on Driver Details… This shows the file version which looks like it’s been change with Windows 7. So replace it with an older version and see what happens.

    Procedure to follow

    1. Boot from an UBCD4WIN disc (or BartPE if you don’t have an SATA hard drive)

    2. Take ownership of the “C:\Windows\System32\Drivers\Beep.sys” file and give the local “Administrators” Group “Full Control” permissions.

    3. Rename “Beep.sys” to “Beep.old” (just in case)

    4. Copy “Beep.sys” from an XP machine to this location.
    Comment by obvious404 on May 9, 2010 @ 12:42 am
    Thanks so much. This fix worked for me 100%.
    Comment by geo on August 12, 2010 @ 11:52 pm
    this works. thanks.
    Attached Files Attached Files
    Last edited by TT(n); March 19th, 2011 at 11:12 PM.

  15. #15
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Guru challenge (seriously!): beep in Win7 64bit

    Here is another link with tutorial on how to take full control of beep.sys.
    http://www.fanhow.com/knowhow:Restor...ows_7_42581702
    Last edited by TT(n); March 20th, 2011 at 01:23 AM.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured