test: msgbeep.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# msgbeep.c

Go to the documentation of this file.

    00001 /****************************** Module Header ******************************\
    00002 * Module Name: msgbeep.c
    00003 *
    00004 * Copyright (c) 1985 - 1999, Microsoft Corporation
    00005 *
    00006 * This module contains the xxxMessageBox API and related functions.
    00007 *
    00008 * History:
    00009 *  6-26-91 NigelT      Created it with some wood and a few nails
    00010 *  7 May 92 SteveDav   Getting closer to the real thing
    00011 \***************************************************************************/
    00012
    00013 #include "precomp.h"
    00014 #pragma hdrstop
    00015 #include <ntddbeep.h>
    00016 #include <mmsystem.h>
    00017
    00018 /***************************************************************************\
    00019 * xxxOldMessageBeep (API)
    00020 *
    00021 * Send a beep to the beep device
    00022 *
    00023 * History:
    00024 * 09-25-91 JimA         Created.
    00025 \***************************************************************************/
    00026
    00027 BOOL xxxOldMessageBeep()
    00028 {
    00029     BOOL b;
    00030     if (TEST_PUDF(PUDF_BEEP)) {
    00031         LeaveCrit();
    00032         b = UserBeep(440, 125);
    00033         EnterCrit();
    00034         return b;
    00035     } else {
    00036         _UserSoundSentryWorker();
    00037     }
    00038
    00039     return TRUE;
    00040 }
    00041
    00042 /***************************************************************************\
    00043 * xxxMessageBeep (API)
    00044 *
    00045 *
    00046 * History:
    00047 *  6-26-91  NigelT      Wrote it.
    00048 * 24-Mar-92 SteveDav    Changed interface - no passing of strings
    00049 *                       If WINMM cannot be found or loaded, then use speaker
    00050 \***************************************************************************/
    00051
    00052 BOOL xxxMessageBeep(
    00053     UINT dwType)
    00054 {
    00055     UINT sndid;
    00056     PTHREADINFO  pti = PtiCurrent();
    00057
    00058     if (pti->TIF_flags & TIF_SYSTEMTHREAD) {
    00059         xxxOldMessageBeep();
    00060         return TRUE;
    00061     }
    00062
    00063     if (!TEST_PUDF(PUDF_BEEP)) {
    00064         _UserSoundSentryWorker();
    00065         return TRUE;
    00066     }
    00067
    00068     switch(dwType & MB_ICONMASK) {
    00069     case MB_ICONHAND:
    00070         sndid = USER_SOUND_SYSTEMHAND;
    00071         break;
    00072
    00073     case MB_ICONQUESTION:
    00074         sndid = USER_SOUND_SYSTEMQUESTION;
    00075         break;
    00076
    00077     case MB_ICONEXCLAMATION:
    00078         sndid = USER_SOUND_SYSTEMEXCLAMATION;
    00079         break;
    00080
    00081     case MB_ICONASTERISK:
    00082         sndid = USER_SOUND_SYSTEMASTERISK;
    00083         break;
    00084
    00085     default:
    00086         sndid = USER_SOUND_DEFAULT;
    00087         break;
    00088     }
    00089
    00090     if (gspwndLogonNotify) {
    00091         _PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, LOGON_PLAYEVENTSOUND, sndid);
    00092     }
    00093
    00094     _UserSoundSentryWorker();
    00095
    00096     return TRUE;
    00097 }
    00098
    00099 /***************************************************************************\
    00100 * xxxPlayEventSound
    00101 *
    00102 * Play a sound
    00103 *
    00104 * History:
    00105 * 09-25-91 JimA         Created.
    00106 \***************************************************************************/
    00107
    00108 VOID PlayEventSound(UINT idSound)
    00109 {
    00110     PTHREADINFO    pti = PtiCurrent();
    00111
    00112     if (!TEST_PUDF(PUDF_EXTENDEDSOUNDS))
    00113         return;
    00114
    00115     if (pti->TIF_flags & TIF_SYSTEMTHREAD)
    00116         return;
    00117
    00118     if (gspwndLogonNotify) {
    00119         _PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, LOGON_PLAYEVENTSOUND, idSound);
    00120     }
    00121
    00122 //  BUGBUG -- we should only flash SoundSentry if a sound is played.  With the
    00123 //  new technique of posting to WinLogon, we can't determine this here.
    00124 //   _UserSoundSentryWorker();
    00125
    00126 }