This is a mirror of official site: http://jasper-net.blogspot.com/

Adding Restart/Recovery capability to your app's with "Windows Restart and Recovery Recipe" code recipe from MSDN Code Gallery

| Thursday, March 17, 2011
Windows 7 includes two closely related features: Application Restart and Application Recovery. These features are designed to eliminate much of the pain caused by the unexpected termination of applications, whether as a result of an unhandled exception, a “hard hang,” or an external request that is part of updating a DLL or other resource in use by the application.

Application Recovery applies to applications that have a “document” or any other in-memory information that might be lost when the application closes unexpectedly, such as when an unhandled exception is thrown.Application Restart applies to all applications, whether they might have unsaved data or not, and to more unexpected closes, including a DLL update or a system reboot.

Any Windows application can register with the operating system for restart, and optionally for recovery.

To register for recovery, the application provides a callback function. The operating system will call this function on a separate thread (remember, your main thread just throw an exception) if the application crashes or hangs. The callback function can save any unsaved data in a known location. It cannot access the UI thread, which is no longer running. Do note, that the call back function cant run forever. The OS will not permit it to run more than few seconds.
To register for restart, the application provides a command line argument that will inform the application it is restarting. A restarted application that uses recovery can look in the known location for recovery data when it is restarted, and reload the unsaved data.
This recipe provide guidance and an easy way to start using these great features in your application, removing any complication of how and where to store your application data.

What’s in the box?

This Restart and Recovery recipe includes:

Complete source code of the recipe and its samples
Managed .NET assembly
C++ header and class files to be included in your C++ application.
C#, and C++ test applications
Documentation

Read more: MSDN

Posted via email from Jasper-net

0 comments: