Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 05-02-2009
Member
 
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?
Reply With Quote
  #2  
Old 05-02-2009
Member
 
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!
Reply With Quote
  #3  
Old 05-02-2009
Member
 
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?
Reply With Quote
  #4  
Old 05-02-2009
Member
 
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!
Reply With Quote
  #5  
Old 05-02-2009
Member
 
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Traping the power notifications in DotNet"
Thread Thread Starter Forum Replies Last Post
LED Notifications for sms and email notifications in HTC Trophy SirName Portable Devices 5 19-06-2012 11:46 AM
my blackberry phone does not get facebook notifications or twitter notifications Dorkfoot Portable Devices 5 06-09-2011 08:29 PM
Need information on DotNet Framework Captain Samuel Salt Operating Systems 3 04-04-2011 08:18 PM
Java or Dotnet is better? getkiran Software Development 9 15-10-2010 09:49 PM
What is Ajax DotNet? Pratim Software Development 4 06-02-2010 06:09 AM


All times are GMT +5.5. The time now is 01:38 PM.