Results 1 to 5 of 5

Thread: Traping the power notifications in DotNet

  1. #1
    Join Date
    Jan 2009
    Posts
    22

    Traping the power notifications in DotNet

    Hi,
    I am using Visual Studio 2005 VB.NET.
    I want to code an application that can trap the On OR OFF events of an handheld device.

    Do you have any Idea how to do this?

  2. #2
    Join Date
    May 2008
    Posts
    35

    Re: Traping the power notifications in DotNet

    Hello AmolP!
    You cant trap this using only an application you need a driver for this which will communicate with the device & send you the notifications.

    Hope this helps you!

  3. #3
    Join Date
    Jan 2009
    Posts
    22

    Re: Traping the power notifications in DotNet

    Thanks for the reply!
    I want to perform some action in my application when the handheld gets power on after a standby mode or like that.
    I went through the Power Management
    reference present in the Windows CE Sdk. But I'm not able
    to call the RequestPowerNotifications() and other related
    methods.

    Please help me if you know how to do this?

  4. #4
    Join Date
    May 2008
    Posts
    115

    Re: Traping the power notifications in DotNet

    I am not sure about this but according to me you have to use the CeRunAppAtEvent with NOTIFICATION_EVENT_WAKEUP.

    http://msdn.microsoft.com/en-us/library/aa932775.aspx

    Hope this helps!

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Traping the power notifications in DotNet

    Here's the code to call the CerunAppAtEvent in VB .NET !
    Add 2 buttons in a form (1 for activate, 1 for deactivate: one call the Activate Method and the other the Deactivate Method)

    Code:
    Public Class ExecEvent
            <System.Runtime.InteropServices.DllImport("coredll.dll")> _
             Private Shared Function CeRunAppAtEvent(ByVal AppName As String, ByVal WhichEvent As Integer) As Boolean
            End Function
            Const NOTIFICATION_EVENT_NONE = 0
            Const NOTIFICATION_EVENT_TIME_CHANGE = 1
            Const NOTIFICATION_EVENT_SYNC_END = 2
            Const NOTIFICATION_EVENT_DEVICE_CHANGE = 7
            Const NOTIFICATION_EVENT_RS232_DETECTED = 9
            Const NOTIFICATION_EVENT_RESTORE_END = 10
            Const NOTIFICATION_EVENT_WAKEUP = 11           'PocketPC only
            Const NOTIFICATION_EVENT_TZ_CHANGE = 12        'PocketPC only
            Private Shared bRet As Boolean
            Private Shared AppPath As String = "\windows\calc.exe"
    
            Public Shared Sub Activate()
                Try
                    bRet = CeRunAppAtEvent(AppPath, NOTIFICATION_EVENT_SYNC_END)
                Catch
                    MessageBox.Show(Err.Description)
                End Try
            End Sub
    
            Public Shared Sub Deactivate()
                Try
                    bRet = CeRunAppAtEvent(AppPath, _
                                            NOTIFICATION_EVENT_NONE)
                Catch
                    MessageBox.Show(Err.Description)
                End Try
            End Sub
        End Class

Similar Threads

  1. Replies: 5
    Last Post: 19-06-2012, 11:46 AM
  2. Replies: 5
    Last Post: 06-09-2011, 08:29 PM
  3. Need information on DotNet Framework
    By Captain Samuel Salt in forum Operating Systems
    Replies: 3
    Last Post: 04-04-2011, 08:18 PM
  4. Java or Dotnet is better?
    By getkiran in forum Software Development
    Replies: 9
    Last Post: 15-10-2010, 09:49 PM
  5. What is Ajax DotNet?
    By Pratim in forum Software Development
    Replies: 4
    Last Post: 06-02-2010, 06:09 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,727,359,952.46825 seconds with 17 queries