Rohit asked:
> How did you achieve the async beep ?
Good question. I mentioned that you can do it and that it is a little
obscure in the MSDN documentation, but I never got to show the actual
code.
For those that are just joining us that problem is that MessageBeep plays
the systems sounds synchronously, so if the user has chosen a long sound
(like Meg Ryan doing her thing in that cafe scene), the user will have to
wait until the sound has finished playing before your application responds
again. And even on short sounds the pause is noticeable and annoying.
So after reading the documentation to the PlaySound call one day I found
that by figuring out the magic names for the system sounds and using the
SND_ALIAS parameter you can play systems sounds with more control than
MessageBeep.
So we basically changed the MessageBeep calls in our app to our own
routine that does the following:
case uType of
MB_ICONASTERISK:
PlaySound('SystemAsterisk', 0, SND_ALIAS + SND_ASYNC);
MB_ICONEXCLAMATION:
PlaySound('SystemExclamation', 0, SND_ALIAS + SND_ASYNC);
MB_ICONHAND:
PlaySound('SystemHand', 0, SND_ALIAS + SND_ASYNC);
MB_ICONQUESTION:
PlaySound('SystemQuestion', 0, SND_ALIAS + SND_ASYNC);
MB_OK:
PlaySound('SystemDefault', 0, SND_ALIAS + SND_ASYNC);
else
MessageBeep(uType)
end;
The message types that are translated into PlaySound alias calls are all
that are documented as being available on NT and 95, there are other
platform specific ones, but we were more concerned with the basic sounds.
For a little more (and I mean little 8-() consult the Win32 API
documentation on PlaySound.
Cheers, Max.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz