MobileDevice.Hibernate Event

Provides access to the WM_HIBERNATE message in Windows CE.

Namespace: Microsoft.WindowsCE.Forms
Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)

Syntax

'Declaration
Public Shared Event Hibernate As EventHandler
'Usage
Dim handler As EventHandler

AddHandler MobileDevice.Hibernate, handler
public static event EventHandler Hibernate
public:
static event EventHandler^ Hibernate {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
/** @event */
public static void add_Hibernate (EventHandler value)

/** @event */
public static void remove_Hibernate (EventHandler value)
JScript supports the use of events, but not the declaration of new ones.

Remarks

When memory pressure from running applications is intensive, Windows CE sends the WM_HIBERNATE message to top level windows. You can respond to this event in managed code with the Hibernate event.

You can provide code in an event handler to reduce resource usage to accommodate memory pressure from other applications running on the device. This event is specific only to the current thread.

Example

The following code example shows how to add and use an event handler for the Hibernate event.

' Connect an event handler, 
' OnHibernate, to the Hibernate event.
AddHandler MobileDevice.Hibernate, AddressOf OnHibernate
// Connect an event hander, OnHibernate, to the Hibernate event.
MobileDevice.Hibernate += new EventHandler(OnHibernate);
' Respond to the Hibernate event.
Private Sub OnHibernate(sender As Object, e As EventArgs)

 ' Add code here to release cached resources
 ' for relieving memory pressure.

End Sub
private void OnHibernate(object sender, EventArgs e)
{
   // Add code here to release cached resources
   // for relieving memory pressure.
 
}

.NET Framework Security

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Platforms

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Compact Framework

Supported in: 2.0

See Also

Reference

MobileDevice Class
MobileDevice Members
Microsoft.WindowsCE.Forms Namespace