Click here to Skip to main content
11,927,006 members (49,630 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET media
here is the situation guys:

I am developing an alarm clock for myself. An alarm clock that can wake me up in the morning with a song i choose and which automatically shutdown the computer after the song finishes.

So my problem is:

#How can i let my alarm to perform that 'shutdown operation' just after the song has stopped(finished)#
Posted 22-May-12 9:31am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can use the function ExitWindowsEx through P/Invoke:[^],[^].

If you need to learn P/Invoke, please see:[^],[^].

This CodeProject article can also be useful:
Essential P/Invoke[^].

Detection of the end of a song could be more tricky; and it depends on what do you use for a player. For example, if you use AxWindowsMediaPlayer, you can handle the event PlayStateChange:[^],[^].

With WPF, you would handle the event System.Windows.Controls.MediaElement.MediaEnded:[^].

Espen Harlinn 22-May-12 19:08pm
Excellent :-D
SAKryukov 22-May-12 19:44pm
Thank you, Espen.
losmac 23-May-12 12:06pm
I agree with you, Espen. +5!

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 | Mobile
Web03 | 2.8.151126.1 | Last Updated 22 May 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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