Click here to Skip to main content
13,597,389 members
Rate this:
Please Sign up or sign in to vote.
I am developing windows service in in VS2010

In some case I want to play system default sound for user notification.

I had tried following code to play sound but it's not playing any sound.


 'I checked by attaching debug that the path is correct
My.Computer.Audio.Play(Path.Combine(My.Application.Info.DirectoryPath, "Blip.wav"), AudioPlayMode.Background)


Even I checked the check box of "Allow to interact with desktop" in service properties after installing service using "InstallUtil"

I checked the speaker connected with my pc.

I have tested it in win xp and win 7

Please help me to resolved this issue and let me know where I am going wrong.

Posted 5-Jan-13 0:53am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I don't think you can play sounds from a service. At least, I've never heard of a single service ever playing a sound. That was always left up to a user-mode application that talks to the service and receives notifications from it, via named pipes or some other communication method.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I succeed with this link[^] even if user has not logged in the service will play sound.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web02-2016 | 2.8.180621.3 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100