Solved

Telling Windows to stop playing sounds

Posted on 1998-07-09
8
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 92
Base1 Encode/Decode 3 86
Firemonkey allowing RTL on android 6 56
Delphi Seattle StructureView color 1 21
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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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