Click here to Skip to main content
Click here to Skip to main content

Alarm-WakeUp Call

, 17 Oct 2007
Rate this:
Please Sign up or sign in to vote.
This application is developed for alarm setting and can be used for your morning wake up call.

Introduction

This is a wake up alarm application. This application is developed using VB.NET. You can download both the Setup and the sample source code for this application. For the Setup, you first need to download and install .NET Framework 1.1. You can download it from here: http://www.microsoft.com/downloads/details.aspx?FamilyID=262d25e3-f589-4842-8157-034d1e7cf3a3&displaylang=en. After installing the application, you can run the setup. Using this application you can set alarm whenever needed. This application uses Timer control, NotifyIcon with Context Menu, and playing a sound file.

Background

I was searching for a morning wake-up alarm software in the internet. And I thought I could created my own using VB.NET.

Using the code

This code has a SimpleSound.vb class file for playing and stopping a sound file. Most users do not have a clear idea about Notify Icon. This code illustrates in detail the use of NotifyIcon.

//
// This is to Play the Sound
Public Shared Sub Play(ByVal Name As String, ByVal [Loop] As Boolean)
    If Not m_hgData.Equals(IntPtr.Zero) Then
        StopPlaying()
    End If
    ' get the namespace 
    Dim strNameSpace As String = _
      System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString()
    ' get the resource into a stream
   
    Dim st As Stream = _
      System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(_
      strNameSpace + "." + Name)
    If st Is Nothing Then Exit Sub
    Dim intLength As Integer = CInt(st.Length)
    Dim abyt(intLength - 1) As Byte
    st.Read(abyt, 0, intLength)
    st.Close()
    m_hgData = Marshal.AllocHGlobal(intLength)
    Marshal.Copy(abyt, 0, m_hgData, intLength)
    Dim Flags As Int32 = SND_MEMORY Or SND_ASYNC
    If [Loop] Then
        Flags = Flags Or SND_LOOP
    End If
    PlaySound( _
    m_hgData, _
    IntPtr.Zero, _
    Flags _
    )
End Sub

Points of Interest

I learnt about playing sounds and using NotifyIcon in the System tray.

History

  • Version 1.0

License

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

Share

About the Author

syed shanu
Team Leader
India India
Visit My SHANU Blog
I have 8+ Years of Exp in Microsoft Technologies.Apart from my professional life i love to be spend more time with my son Syed Afraz who is 6 Years old now and doing his 1st grade at Elementary School.
Follow on   Twitter   Google+

Comments and Discussions

 
GeneralThanks a bunch Pinmembernorm .net18-Oct-07 0:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140814.1 | Last Updated 18 Oct 2007
Article Copyright 2007 by syed shanu
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid