By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,335 Members | 1,293 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,335 IT Pros & Developers. It's quick & easy.

Play a Windows Sound

P: n/a
Hi There!

How do I play a sound from Windows that get played when a USB device is
plug-in or plug out?

Many thanks in advance!!

Jon
Feb 4 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
If you're using VS 2005: My.Computer.Audio.Play("SoundFile")

"Jon B" <no*****@sorry.sorrywrote in message
news:u%****************@TK2MSFTNGP06.phx.gbl...
Hi There!

How do I play a sound from Windows that get played when a USB device is
plug-in or plug out?

Many thanks in advance!!

Jon

Feb 4 '07 #2

P: n/a
What type of device are you plugging in to the USB?

I wrote an application a few weeks ago that detects flash drives plugged in
to the USB ports & also alerts if the device is removed, but that is only
for flash drives, not other devices.

This was done by overriding WndProc & checking for the correct Windows
Message.

Without knowing which type of device ifs not going to be easy to help you

--
Newbie Coder
(It's just a name)


"Jon B" <no*****@sorry.sorrywrote in message
news:u%****************@TK2MSFTNGP06.phx.gbl...
Hi There!

How do I play a sound from Windows that get played when a USB device is
plug-in or plug out?

Many thanks in advance!!

Jon


Feb 5 '07 #3

P: n/a
Hi There,

There are no devices plugged into the computer. I just want to micmic the
sound that Windows XP plays when USB devices are plugged-in and plugged-out
in my application when my application state changes (such as switching to
Offline mode and back on...etc).

This is only as a mean for user to get the notification of my application
state by sound. No actual hardware is plugging in or out.

Cheers,
Jon

"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:uS**************@TK2MSFTNGP05.phx.gbl...
What type of device are you plugging in to the USB?

I wrote an application a few weeks ago that detects flash drives plugged
in
to the USB ports & also alerts if the device is removed, but that is only
for flash drives, not other devices.

This was done by overriding WndProc & checking for the correct Windows
Message.

Without knowing which type of device ifs not going to be easy to help you

--
Newbie Coder
(It's just a name)


"Jon B" <no*****@sorry.sorrywrote in message
news:u%****************@TK2MSFTNGP06.phx.gbl...
>Hi There!

How do I play a sound from Windows that get played when a USB device is
plug-in or plug out?

Many thanks in advance!!

Jon



Feb 5 '07 #4

P: n/a
Jon,

The sounds are simply .wav's that Windows stores in the C:\Windows\Media
folder. The two .wav's that you mention are 'Windows XP Hardware Insert' and
'Windows XP Hardware Remove'. You should be able to play them with little or
no trouble at all by using the Soundplayer Class in .Net 2.0. If you're
using VS 2005, just search the help for SoundPlayer.

HTH,
Bruce

"Jon B" <no*****@sorry.sorrywrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi There,

There are no devices plugged into the computer. I just want to micmic the
sound that Windows XP plays when USB devices are plugged-in and
plugged-out in my application when my application state changes (such as
switching to Offline mode and back on...etc).

This is only as a mean for user to get the notification of my application
state by sound. No actual hardware is plugging in or out.

Cheers,
Jon

"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:uS**************@TK2MSFTNGP05.phx.gbl...
>What type of device are you plugging in to the USB?

I wrote an application a few weeks ago that detects flash drives plugged
in
to the USB ports & also alerts if the device is removed, but that is only
for flash drives, not other devices.

This was done by overriding WndProc & checking for the correct Windows
Message.

Without knowing which type of device ifs not going to be easy to help you

--
Newbie Coder
(It's just a name)


"Jon B" <no*****@sorry.sorrywrote in message
news:u%****************@TK2MSFTNGP06.phx.gbl...
>>Hi There!

How do I play a sound from Windows that get played when a USB device is
plug-in or plug out?

Many thanks in advance!!

Jon




Feb 5 '07 #5

P: n/a
Does it have solution with VS2003?

Thanks,

Peter

Feb 5 '07 #6

P: n/a
No Peter, but take a look at this link. It should give you a good idea of
what you can do to play a .wav in VS2003.

http://www.gringod.com/2005/01/21/pl...urce-in-vbnet/

Bruce

"Peter" <zl*****@sina.comwrote in message
news:OV**************@TK2MSFTNGP02.phx.gbl...
Does it have solution with VS2003?

Thanks,

Peter

Feb 5 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.