Jia En

Jia En

  • NA
  • 30
  • 0

How to respond to system shutdown??

Jan 17 2006 2:35 AM

I have created a console application, and I used the code below to get the respond from the system shutdown.. But it don't seems to be working.. And I owaz get this error

c:\jia en\tcp\client_standalone\client.cs(96,27): error CS0115: 'Client.Client.WndProc(ref System.Windows.Forms.Message)': no suitable method found to override


Please HELP me.. Thankz..

protected
override void WndProc(ref System.Windows.Forms.Message m)

{

if(m.Msg==WM_QUERYENDSESSION)

{

isShuttingDown=true;

}

base.WndProc(ref m);

}

private void Client_Closing(object sender, System.ComponentModel.CancelEventArgs e)

{

if(isShuttingDown)

{

e.Cancel=false;

isShuttingDown = false;

string endTime = GetTime();

#region Display client's machine name

System.Security.Principal.WindowsPrincipal wp = new

System.Security.Principal.WindowsPrincipal

(System.Security.Principal.WindowsIdentity.GetCurrent());

c.machName = wp.Identity.Name;

Console.WriteLine(c.machName);

#endregion

#region List all the processes running in client machine

Process[] procs = Process.GetProcesses( Environment.MachineName );

foreach (Process process in procs)

{

// Store all the processes in procName

c.procName = process.ProcessName + "\n";

Console.WriteLine(c.procName);

}

#endregion

writeToFile();

}

}


Answers (2)