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

Alarm-WakeUp Call

, 18 Oct 2007 CPOL
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 C# Blog
Mr.Shanu is a Senior Software Engineer. He’s basically from India and working at South Korea for more than 7 years.


He has 9+ years of Experience in Microsoft Technologies. More than 7 Years of experience in Automation Fields, He has worked in several projects of MES, Automation, ERP and HMI programs like PLC, Sensor, RFID and Nutrunner Tools. He has worked in both Windows based and Web Based projects.


Shanu Love to learn and work with new technology.


His main hobbies are to spend time with Family and to create Different and Innvotive programs and write Article about his program and Share with others.

His Latest Article which he likes most was Windows Form Design at Run Time

His facebook page
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
GeneralThanks a bunch Pinmembernorm .net18-Oct-07 1: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 | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 18 Oct 2007
Article Copyright 2007 by syed shanu
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid