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 nameSystem.Security.Principal.WindowsPrincipal wp =
newSystem.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 machineProcess[] procs = Process.GetProcesses( Environment.MachineName );
foreach (Process process in procs){
// Store all the processes in procNamec.procName = process.ProcessName + "\n";
Console.WriteLine(c.procName);
}
#endregion
writeToFile();
}
}
Jia EnPosted Jan 21, 2006, 4:07 AM
AnttiPosted Jan 18, 2006, 4:29 AM
WM_QUERYENDSESSION is not defined, so that needs to be defined too (it's 0x0011 by the way).