Telling Windows to stop playing sounds

There appears to be a strange bug(?) related to Windows 98 and a screen saver that I wrote using Delphi 1.  I have been using and distributing a 16 bit screen saver written with Delphi for many years now, and the screen saver works great under Windows 3.1, Win 95, Win NT 4.0.  However, I am now getting complaints (and can verify the problem) that something very odd occurs when this screen saver is run under Windows 98.

First, if I run the screen saver from a DOS prompt, (e.g., MYSAVER.SCR /S) the screen saver runs perfectly.

However, if I sit back and allow Win98 to load the screen saver automatically after waiting the "x" wait minutes, then the problem/bug occurs.

What is the bug?  The bug is this...  If you have a WAV sound file linked to the "Windows default" sound scheme's "Open program" action, then this bug will be seen (actually "heard").  The bug is this...every 2 seconds, the "Open program" WAV file will play!  Throughout the duration that the screen saver is active and running, every 2 seconds the "Open program" WAV file will play...over, and over again.

Any idea why something so unusual would be occuring?  Especially since "MYSAVER.SCR /S" from the command line runs perfectly, with no repetitious sounds.

This behavior does not occur with any of the Win98 screen savers that come with Win 98.  And if this is a Win 98 bug, and I must find a "workaround", does anyone have any suggestions on how to turn off the playing of WAV files for the duration for the screen saver, and then turn sound playing back on once the screen saver closes down?

Thanks.
Monroe406Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ZifNabConnect With a Mentor Commented:
hi Monroe406,

Just set the wav -volume OFF.
Freeware components enough which let you do this.

If you don't have one, let me know I'll send you one or give the URL.

Zif.
0
 
Monroe406Author Commented:
Edited text of question
0
 
ZifNabCommented:
Hi Monroe406, (Peugot 406?)

This is already something, don't know if it works, never tested it :

//
// Using Audio Volume Control API
//
unit WaveUnit;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls,
  Forms, Dialogs, MMSystem, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
 NumDevs     : Integer;
 waveCaps    : TWaveOutCaps;
 Volume      : DWORD;
 Left, Right : Word;
 Version     : Word;
begin
// We should have at least one device
  NumDevs := waveOutGetNumDevs;
  Edit1.Text := Format('Number of devices is %d', [NumDevs]);
// for the 1st device (hard-coded)
// Get Device Caps
  waveOutGetDevCaps(0, @waveCaps, SizeOf(waveCaps));
// Show device caps
  Memo1.Lines.Add('Íàçâàíèå: '+waveCaps.szPName);
  Version := waveCaps.vDriverVersion;
  Memo1.Lines.Add(Format('Âåðñèÿ äðàéâåðà: %d.%d', [Hi(Version), Lo(Version)]));
  Case waveCaps.wChannels of
    1 : Memo1.Lines.Add('Ìîíî');
    2 : Memo1.Lines.Add('Ñòåðåî');
  End;
 // Standard formats

 If waveCaps.dwFormats AND WAVE_FORMAT_1M08 <> 0 Then
  Memo1.Lines.Add('11.025 kHz, mono, 8-bit');
 If waveCaps.dwFormats AND WAVE_FORMAT_1M16 <> 0 Then
  Memo1.Lines.Add('11.025 kHz, mono, 16-bit');
{
WAVE_FORMAT_1S08        11.025 kHz, stereo, 8-bit
WAVE_FORMAT_1S16        11.025 kHz, stereo, 16-bit
WAVE_FORMAT_2M08        22.05 kHz, mono, 8-bit
WAVE_FORMAT_2M16        22.05 kHz, mono, 16-bit
WAVE_FORMAT_2S08        22.05 kHz, stereo, 8-bit
WAVE_FORMAT_2S16        22.05 kHz, stereo, 16-bit
WAVE_FORMAT_4M08        44.1 kHz, mono, 8-bit
WAVE_FORMAT_4M16        44.1 kHz, mono, 16-bit
WAVE_FORMAT_4S08        44.1 kHz, stereo, 8-bit
WAVE_FORMAT_4S16        44.1 kHz, stereo, 16-bit
}

// If Volume Control Supported
  If waveCaps.dwSupport AND WAVECAPS_VOLUME <> 0 Then
   Begin
    waveOutGetVolume(0, @Volume);
    Left  := LoWord(Volume);
    Right := HiWord(Volume);
// Show values of WAVE Device on volume control panel
    Edit2.Text := Format('Left : %d, Right : %d', [Left, Right]);
   waveOutSetVolume(0, $40008000);
   End;
end;

end.

Zif.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Monroe406Author Commented:
>> If you don't have one, let me know I'll send you one or give the URL.

A URL would be useful, since the example you provided is Delphi 2/3 and not 16-bit Delphi 1 compatible, and hence won't work.


0
 
ZifNabCommented:
Heck, damn you already take this answer as correct one and all the URL's I wanted to give you are for 32bit (D2,3,..?). Thought that you wanted to change your code exclusively for win 32bit applications. (besides, isn't that a good idea? Since it is already a finished project, you could port the 16bit to 32bit screensaver, then you have also a 32bit code for 32bit systems, much better. Sorry, but I don't know how to shut up sound in a 16bit environment.
0
 
Monroe406Author Commented:
>> Thought that you wanted to change  your code exclusively for win 32bit applications.


I did not state that in my original message.  I stated I was using Delphi 1, and that the screen saver I created is behaving unusual under Windows 98.  The 16-bit Delphi screen saver works fine under Win3.x, Win 95 and Win NT.  I never said that I wanted to convert to a 32 bit screen saver.

>> Since it is already a finished project, you could port the 16bit to 32bit  screensaver

It's not that easy, since porting is not a simple recompile.  Several procedures use methods that don't exist, or require different parameters.

I would rather have a 16 bit screen saver run under all Windows OS's, than to convert to a 32 bit screen saver and lose Windows 3.x clients/customers.

>> Heck, damn you already take this answer as correct one

Don't worry about it.  I found a solution to my problem without having to disable the sound.

0
 
ZifNabCommented:
I'll look at a solution too.
0
 
tktkCommented:
I have this Component.
It a very nice component, If you want it email me:    talklein@ort.org.il
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.