CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003
    Posts
    10

    Playing a beep under Win98

    Hi,

    I want to play a beep sound with a specified frequency and duration under Win 98 and Win2000.
    I know, that there is no problem with Win2000, because the function "Beep(freq, duration)" plays such specified sound.
    Under Win98 the parameters are ignored. So : is there an easy way to play such a sound ? or do I have to use DirectSound ?

    Thank's in advance,

    Corkwick

  2. #2
    Join Date
    Sep 1999
    Location
    Colorado, USA
    Posts
    1,002
    "Notify.wav" is a beep sound. It's in the Windows\Media directory.

    #include <mmsystem.h>

    Include the library file
    #pragma comment(lib, _T("winmm.lib"))

    Then use PlaySound().
    You can use SND_FILENAME | SND_ASYNC | SND_NODEFAULT as flags.
    Add SND_LOOP if you want to loop it.

    So, the whole thing might look like
    PlaySound(_T("C:\\Windows\\Media\\Notify.wav"), NULL, SND_FILENAME | SND_ASYNC | SND_NODEFAULT);

    Steve

  3. #3
    Join Date
    Jun 2003
    Posts
    10
    Thank you, Steve,

    my problem ist, that I want to dynamically change duration and frequency of the beep,

    so loading a .wav file is no option.

    Do you have any other solution for me ?

    Thanks again,

    Corkwick

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