I'm developing an in-house .NET application that will be run on a VM (with VMware), and want to know if there's a way to get notifications from VM system events (like suspending, resumed, etc.)
Anyone know of a convenient way to do that? The virtual machine has VMware Tools installed, does that provide a .NET API for hooking events?
EDIT: In particular, I'm interested in when the system has just resumed. I assumed that this doesn't correspond to any "regular" Windows system event (after all, the whole point of suspending and resuming a VM is that Windows has no idea what happened). Am I mistaken? Will that trigger an event?
EDIT 2: I wrote this quick console app to hook all the System Events I could think of, and get nothing when I suspend/resume:
static void Main(string[] args) {
SystemEvents.DisplaySettingsChanged += (sender, e) => Console.WriteLine("Display settings changed");
SystemEvents.EventsThreadShutdown += (sender, e) => Console.WriteLine("Events thread shutdown");
SystemEvents.PowerModeChanged += (sender, e) => Console.WriteLine("Power mode changed");
SystemEvents.SessionEnding += (sender, e) => Console.WriteLine("Session ending");
SystemEvents.SessionSwitch += (sender, e) => Console.WriteLine("Session switch");
SystemEvents.UserPreferenceChanging += (sender, e) => Console.WriteLine("User preference changing");
Console.ReadLine();
}