Solved

Telling Windows to stop playing sounds

Posted on 1998-07-09
8
174 Views
Last Modified: 2010-04-04
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.
0
Comment
Question by:Monroe406
  • 4
  • 3
8 Comments
 

Author Comment

by:Monroe406
ID: 1357542
Edited text of question
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
ID: 1357543
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
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357544
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
 

Author Comment

by:Monroe406
ID: 1357545
>> 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 8

Expert Comment

by:ZifNab
ID: 1357546
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
 

Author Comment

by:Monroe406
ID: 1357547
>> 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
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357548
I'll look at a solution too.
0
 

Expert Comment

by:tktk
ID: 1357549
I have this Component.
It a very nice component, If you want it email me:    talklein@ort.org.il
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now