I am developing my own .NET application that will be running on a virtual machine (with VMware) and will want to find out if there is a way to receive notifications from VM system events (for example, pause, resume, etc.).
Does anyone know of a convenient way to do this? VMware tools are installed on the virtual machine, does it support the .NET API for connecting events?
EDIT: In particular, I'm interested in when the system just resumed. I suggested that this does not correspond to the "regular" Windows system event (after all, the whole moment of pausing and resuming a virtual machine is that Windows does not know what happened). Am I mistaken? Will this trigger an event?
EDIT 2: I wrote this quick console application to hook up all the system events that I could think of and don't get anything when I pause / 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();
}
source
share