Windows Server
(1)
Visual Studio
(1)
XP
(1)
PlaySound
(1)
Doorbell
(1)
Apps
(1)
Theevents
(1)
Addendum
(1)

sound question

Asked By someone watching
19-Mar-10 09:31 PM
XP has sound options for 'device connect' and 'device disconnect'. I like it
especially when it triggers for USB devices. Was wondering if there is any
way to add these options to W2K's sound menu. I am thinking there might be
because Norton Utilities (which is installed here) has options of its own in
the menu.

anybody?

"someone watching" wrote:Short answer: No, you cannot do that.

Robbie Hatley replied to someone watching
20-Mar-10 10:24 PM
Short answer:  No, you cannot do that.


Complete answer:

Yes, maybe you can do that, but you will have to learn Windows
programming (in C, C++, C#, or Visual-Basic) first.

Software can do sounds because it calls Win2K's API funtion "PlaySound"
in the following dll:

C:\WINNT\system32\winmm.dll

You can find the settings in the registry which list which sounds
can be played when certain programs send certain events:

HKEY_Current_User\AppEvents\Schemes\Apps

You can put entries in there to play certain sounds when certain named
events are sent from certain programs.  For example, you could say:
- play "dingdong.wav" when program aardvark.exe sends event "Doorbell"
- play "screeech.wav" when program barn_owl.exe sends event "Hoot"

This is organized by user, app, event, and sound scheme, in that order,
so the tree really looks more like:

user1
Schemes
Apps
App1
App1Event1
Scheme1
ding.wav
Scheme2
swish.wav
App1Event2
Scheme1
smash.wav
Scheme2
crunch.wav
user2
Schemes
Apps
App1
App1Event1
Scheme1
snivel.wav
Scheme2
simper.wav
App1Event2
Scheme1
whirr.wav
Scheme2
whine.wav

But to send the events, you would  need access to the source code and compiler
used to make the program, and you would  have to speak the language the program
is written in (C, C++, Visual-Basic, or whatever), and be familiar with the
Win32 API for sending sound events to the OS.

To modify Win2K so that it plays certain sounds for certain hardware events,
you would  have to have the Windows 2000 source code.  Bill could give you that...
but then he'd have to kill you.  ;-)

So in short, no, I do not think you can modify Win2K to play certain
sounds when certain events happen, except to the extent that Win2K is
already set-up to play sounds for those events.

But you might be able to write a program that monitors hardware events
such as devices being unplugged, and sends "play sound" messages to
Win2k (via the PlaySound API function) when these hardware events occur.
Unless you are a windows programmer, this is not going to be easy, though:
1. Get Visual Studio.
2. Get Kernigan's "The C Programming Language" and learn C.
3. Get Petzold's "Programming Windows" and learn Win32 programming.
4. Write a program that monitors hardware events and tells windows
to play certain sounds when certain events occur.

Or, you could do it in Visual Basic.  Here is an related article:
http://www.vb6.us/tutorials/playsound-api

As to exactly how to monitor for devices being unplugged, I do not know.
You could try asking in the win32 programming Usenet groups, such as
microsoft.public.win32.programmer

--
Cheers,
Robbie Hatley
lonewolf at well dot com
www dot well dot com slant tilde lonewolf slant

Brief addendum: one other group to ask in.

Robbie Hatley replied to Robbie Hatley
20-Mar-10 10:33 PM
I'd recommended to "Someone Watching":


But on looking in that group, it is not very active.  Another group,
this one much more active, where you can ask about Win32 API issues is:

comp.os.ms-windows.programmer.win32

--
Cheers,
Robbie Hatley
lonewolf at well dot com
www dot well dot com slant tilde lonewolf slant

theevents,that...

someone watching replied to Robbie Hatley
20-Mar-10 11:12 PM
the
events,
that...


Yea, I kinda figured that when I went looking in the registry and saw sounds
listed for events, but that was it. You explained what I figured ... a call
for sound has to be programmed!

Thanks for the explanation!
BTW, glad you figured what was causing all the headaches with your W2k
setup. I went and reconfigured  AGP settings here after reading your post!
"someone watching" wrote:I suggest you look and see if any programs of that
Robbie Hatley replied to someone watching
21-Mar-10 12:05 AM
I suggest you look and see if any programs of that nature
already exist!  Something called "Hardware Event Audible Notifier" or
some such thing.  Look around.  No sense reinventing a wheel.

That failing, if you have free time, why not make it and sell it for
$20 on tucows?  Sure you might have to learn Visual Basic, but what
the heck, it'd improve your resume, and you would  make some ca$h on the side.


Well, actually, I did not.  It went down like this:
1. Robbie has problem.
2. Robbie thinks he is finally fixed problem 'cause it worked for 10 days.
3. Robbie comes here and brags about it.
4. An hour later, problem comes back (again) like a cat that will not stay away.

Sigh.

BUT, something interesting happened tonight....  more on that in
separate post.

--
Cheers,
Robbie Hatley
lonewolf at well dot com
www dot well dot com slant tilde lonewolf slant
Post Question To EggHeadCafe