void SystemEvents_PowerModeChanged(Object^ sender, PowerModeChangedEventArgs^ e)
{
switch(e->Mode)
{
case PowerModes::Resume:
Console::WriteLine("System resumed")
// How do I pass in StreamWriter oWrite as a local variable?
// oWrite->WriteLine("System resumed")
}
}
int main(array<System::String ^> ^args)
{
try
{
StreamWriter^ oWrite = gcnew StreamWriter("out.txt");
oWrite->AutoFlush = true
//launch a bunch of threads via ParameterizedThreadStart that aren't related to this specific problem but will keep the program from ending before I want it to
...
SystemEvents::PowerModeChanged += gcnew PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
}
catch(System::Exception ^ e)
{
Console::WriteLine(e->Message);
return 1;
}
return 0;
}
What do I need to do to pass parameters, such as oWrite, to the PowerModeChangedEventHandler function? PowerModeChangedEventArgs seems to have "mode" as its only exposed member.