home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 1995 May
/
pcw-0595.bin
/
demos
/
databeck
/
wsounds
/
setup.dir
/
wswsrc.exe
/
ABOUTDLG.PAS
next >
Wrap
Pascal/Delphi Source File
|
1992-12-02
|
2KB
|
84 lines
{
Unit AboutDlg - displays "About..." dialog box
}
Unit aboutDlg;
INTERFACE
uses WinTypes, WinProcs, WinDos, WObjects, Strings, MMSystem;
{$R aboutres.res}
const
dn_AboutDlg = 'ABOUTDLG';
id_PlayAbout= 380;
type
PAboutDlg = ^TAboutDlg;
TAboutDlg = object(TDialog)
constructor Init(AParent: PWindowsObject;AName: PChar);
Procedure SetupWindow;virtual;
Procedure HandleAboutFan(Var Msg : TMessage);virtual id_First + id_PlayAbout;
private
Procedure PlayResWave(ResName : PChar);
end;
implementation
PROCEDURE TAboutDlg.PlayResWave(ResName : PChar);
{
* This proc uses SndPlaySound for playing WAV files (SndPlaySound can be
* found in a resource) using the SND_MEMORY parameter. You can create a
* WAV resource using a resource script file and the resource compiler RC.EXE.
}
VAR
WavResPtr : POINTER;
WavHandle,
WavResInfo : THandle;
BEGIN
WavResInfo := FindResource(HInstance,ResName,'WAVE');
IF NOT(WavResInfo>0) THEN
Halt(1); { Error: Resource not found }
WavHandle := LoadResource(Hinstance,WavResInfo);
IF NOT(WavHandle>0) THEN
Halt(2); { Error: No handle found }
WavResPtr := LockResource(WavHandle);
IF (WavResPtr <> NIL) THEN BEGIN
SndPlaySound (WavResPtr,SND_SYNC OR SND_MEMORY);
{
* The following function call unlocks the resource previously locked into
* memory using LockResource.
* Please note: You can only use this function if you're playing a sound
* using SND_SYNC. Otherwise, a general protection error occurs and the sound
* will lock up because you accessed a resource not specifically addressable
* in memory.
}
UnlockResource(WavHandle)
END;
END;
constructor TAboutDlg.Init(AParent: PWindowsObject;AName: PChar);
begin
TDialog.Init(AParent, AName);
end;
Procedure TAboutDlg.SetupWindow;
VAR
Msg : TMessage;
BEGIN
TDialog.SetupWindow;
TWindowsObject.Show(sw_Show);
HandleAboutFan(Msg);
{ PostMessage(HWindow, wm_Command, id_PlayAbout,0);}
END;
Procedure TAboutDlg.HandleAboutFan(VAR Msg : TMessage);
BEGIN
UpdateWindow(HWindow);
PlayResWave('FANFARE'); { Plays FANFARE.WAV file }
END;
BEGIN
END.