{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% osCommerce Product Manager for Windows (oscpmwin). Copyright ©2003,2004,2005 by Mario A. Valdez-Ramirez. You can contact Mario A. Valdez-Ramirez by email at mario@mariovaldez.org or paper mail at Olmos 809, San Nicolas, NL. 66495, Mexico. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} unit attention; interface USES Dialogs, MMSystem, Windows; FUNCTION FNopm_Message (DialogMsg : STRING; DialogType : TMsgDlgType; DialogControls : TMsgDlgButtons; AllowSound : WORD) : WORD; PROCEDURE PRopm_Sound (EventName : STRING; AllowSound : WORD); FUNCTION FNopm_CheckSound : BOOLEAN; FUNCTION FNopm_Question (DialogMsg, DialogPrompt, DialogDefault : STRING; AllowSound : WORD) : STRING; VAR ExistSoundDevs : BOOLEAN; implementation {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} FUNCTION FNopm_Message (DialogMsg : STRING; DialogType : TMsgDlgType; DialogControls : TMsgDlgButtons; AllowSound : WORD) : WORD; BEGIN IF ((AllowSound < 1) AND (ExistSoundDevs = TRUE)) THEN CASE DialogType OF mtWarning : MessageBeep (MB_ICONASTERISK); mtError : MessageBeep (MB_ICONEXCLAMATION); mtInformation : MessageBeep (MB_OK); mtConfirmation : MessageBeep (MB_ICONQUESTION); END; FNopm_Message := MessageDlg (DialogMsg, DialogType, DialogControls, 0); END; {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} FUNCTION FNopm_Question (DialogMsg, DialogPrompt, DialogDefault : STRING; AllowSound : WORD) : STRING; BEGIN IF ((AllowSound < 1) AND (ExistSoundDevs = TRUE)) THEN MessageBeep (MB_ICONQUESTION); IF (InputQuery (DialogMsg, DialogPrompt, DialogDefault) = TRUE) THEN FNopm_Question := DialogDefault ELSE FNopm_Question := ''; END; {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} // Close, MailBeep, Maximize, MenuCommand, MenuPopup, Minimize, // Open, RestoreDown, RestoreUp, RingIn, RingOut, ShowBand, // SystemAsterisk, SystemDefault, SystemExclamation, SystemExit, // SystemHand, SystemQuestion, SystemStart PROCEDURE PRopm_Sound (EventName : STRING; AllowSound : WORD); BEGIN IF ((AllowSound < 1) AND (ExistSoundDevs = TRUE)) THEN PlaySound (PCHAR (EventName), 0, SND_ALIAS + SND_ASYNC + SND_NODEFAULT); END; {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} FUNCTION FNopm_CheckSound : BOOLEAN; BEGIN IF (WaveOutGetNumDevs > 0) THEN FNopm_CheckSound := TRUE ELSE FNopm_CheckSound := FALSE; END; INITIALIZATION ExistSoundDevs := FNopm_CheckSound; end.