Solved

Telling Windows to stop playing sounds

Posted on 1998-07-09
8
178 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

929 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