RegisterAppStateChangeNotification function (appnotify.h)
Enables an app to register a callback function through which it can be notified that its library is going into or coming out of a suspended state. The app can use this information to perform any necessary operations, such as preserving state, that should be performed at that point.
APICONTRACT ULONG RegisterAppStateChangeNotification( [in] PAPPSTATE_CHANGE_ROUTINE Routine, [in, optional] PVOID Context, [out] PAPPSTATE_REGISTRATION *Registration );
A pointer to a callback function that is called when the app enters or leaves the suspended state. See PAPPSTATE_CHANGE_ROUTINE for more detail on this function.
[in, optional] Context
App-specific context information that the app uses when going into or out of a suspended state. This is commonly a "this" pointer.
When this function returns successfully, this parameter receives the address of a pointer to a value that can be used to identify the registration. Store this value to use with UnregisterAppStateChangeNotification.
A standard Win32 status code.