Source code of file oscpmwin/attention.pas from the
osCommerce Product Manager for Windows.
0000: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001: osCommerce Product Manager for Windows (oscpmwin).
0002: Copyright �2003-2006 by Mario A. Valdez-Ramirez.
0003:
0004: You can contact Mario A. Valdez-Ramirez
0005: by email at mario@mariovaldez.org or paper mail at
0006: Olmos 809, San Nicolas, NL. 66495, Mexico.
0007:
0008: This program is free software; you can redistribute it and/or modify
0009: it under the terms of the GNU General Public License as published by
0010: the Free Software Foundation; either version 2 of the License, or (at
0011: your option) any later version.
0012:
0013: This program is distributed in the hope that it will be useful, but
0014: WITHOUT ANY WARRANTY; without even the implied warranty of
0015: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0016: General Public License for more details.
0017:
0018: You should have received a copy of the GNU General Public License
0019: along with this program; if not, write to the Free Software
0020: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0021: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0022: unit attention;
0023:
0024: interface
0025:
0026: USES Dialogs, MMSystem, Windows;
0027:
0028: FUNCTION FNopm_Message (DialogMsg : STRING; DialogType : TMsgDlgType; DialogControls : TMsgDlgButtons; AllowSound : WORD) : WORD;
0029: PROCEDURE PRopm_Sound (EventName : STRING; AllowSound : WORD);
0030: FUNCTION FNopm_CheckSound : BOOLEAN;
0031: FUNCTION FNopm_Question (DialogMsg, DialogPrompt, DialogDefault : STRING; AllowSound : WORD) : STRING;
0032:
0033: VAR
0034: ExistSoundDevs : BOOLEAN;
0035:
0036: implementation
0037:
0038: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0039: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0040: FUNCTION FNopm_Message (DialogMsg : STRING; DialogType : TMsgDlgType; DialogControls : TMsgDlgButtons; AllowSound : WORD) : WORD;
0041: BEGIN
0042: IF ((AllowSound < 1) AND (ExistSoundDevs = TRUE)) THEN
0043: CASE DialogType OF
0044: mtWarning : MessageBeep (MB_ICONASTERISK);
0045: mtError : MessageBeep (MB_ICONEXCLAMATION);
0046: mtInformation : MessageBeep (MB_OK);
0047: mtConfirmation : MessageBeep (MB_ICONQUESTION);
0048: END;
0049: FNopm_Message := MessageDlg (DialogMsg, DialogType, DialogControls, 0);
0050: END;
0051:
0052:
0053: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0054: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0055: FUNCTION FNopm_Question (DialogMsg, DialogPrompt, DialogDefault : STRING; AllowSound : WORD) : STRING;
0056: BEGIN
0057: IF ((AllowSound < 1) AND (ExistSoundDevs = TRUE)) THEN MessageBeep (MB_ICONQUESTION);
0058: IF (InputQuery (DialogMsg, DialogPrompt, DialogDefault) = TRUE) THEN
0059: FNopm_Question := DialogDefault
0060: ELSE
0061: FNopm_Question := '';
0062: END;
0063:
0064:
0065: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0066: Close, MailBeep, Maximize, MenuCommand, MenuPopup, Minimize,
0067: Open, RestoreDown, RestoreUp, RingIn, RingOut, ShowBand,
0068: SystemAsterisk, SystemDefault, SystemExclamation, SystemExit,
0069: SystemHand, SystemQuestion, SystemStart
0070: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0071: PROCEDURE PRopm_Sound (EventName : STRING; AllowSound : WORD);
0072: BEGIN
0073: IF ((AllowSound < 1) AND (ExistSoundDevs = TRUE)) THEN PlaySound (PCHAR (EventName), 0, SND_ALIAS + SND_ASYNC + SND_NODEFAULT);
0074: END;
0075:
0076:
0077: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0078: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0079: FUNCTION FNopm_CheckSound : BOOLEAN;
0080: BEGIN
0081: IF (WaveOutGetNumDevs > 0) THEN
0082: FNopm_CheckSound := TRUE
0083: ELSE
0084: FNopm_CheckSound := FALSE;
0085: END;
0086:
0087:
0088:
0089: INITIALIZATION
0090:
0091: ExistSoundDevs := FNopm_CheckSound;
0092:
0093: end.