473,490 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Unable to shut down machine when a .net application is running

Hi all,

I have a application developed in C# .net. The problem I face is I am unable
to shutdown my machine
when the exe is running. Windows is unable to close this exe an shut down.
Can anyone help.
Regards,
Kuldeep Pawar
Programmer,
Maximize Learning, Pune.
www.maximizelearning.com
Nov 15 '05 #1
3 3467
Hi Kuldeep,
Most probably, this problem is caused by high memory usage. Your application
is using too much of the memory. But of course, that's most probably. It
might not be the case for you. So best thing is good debugging.
I would suggest to keep commenting chunks of your code per time, and
recompiling, and testing if the problem is still existing. And keep
minimizing your chunks to be able to track the problem.

--
Rami Saad
Microsoft GTSC Developer support for Middle East
"kuldeep" <ku*****@maximizelearning.com> wrote in message
news:uG**************@TK2MSFTNGP11.phx.gbl...
Hi all,

I have a application developed in C# .net. The problem I face is I am unable to shutdown my machine
when the exe is running. Windows is unable to close this exe an shut down.
Can anyone help.
Regards,
Kuldeep Pawar
Programmer,
Maximize Learning, Pune.
www.maximizelearning.com

Nov 15 '05 #2
Hi ,

My application is on tray mode when the form closing button is pressed.

class MyForm : Form
{
private System.Windows.Forms.NotifyIcon_notifyIcon;
private void MyForm_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
this.Visible = false;
}
}

This might force the system not to shutdown.
When system is shutting down, the MyForm_Closing() is called, not
Application.Exit();
So, my application is just on tray mode and, the shutdown process is
stopped.
How to shutdown the application either when I am logging off or shutting
down the machine? I tried by handling the WM_QUERYENDSESSION messagewhere I
set a flag which indicates that call is for shutdown of machine and made
changes in the closing event handler as shown below but its not working.
private System.Windows.Forms.NotifyIcon_notifyIcon;
private void MyForm_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{ if(systemShutdown) {
e.Cancel = false;
} else { e.Cancel = true;
this.Visible = false; }
}



"Rami Saad" <ra*******@egdsc.microsoft.com> wrote in message
news:#i**************@TK2MSFTNGP09.phx.gbl...
Hi Kuldeep,
Most probably, this problem is caused by high memory usage. Your application is using too much of the memory. But of course, that's most probably. It
might not be the case for you. So best thing is good debugging.
I would suggest to keep commenting chunks of your code per time, and
recompiling, and testing if the problem is still existing. And keep
minimizing your chunks to be able to track the problem.

--
Rami Saad
Microsoft GTSC Developer support for Middle East
"kuldeep" <ku*****@maximizelearning.com> wrote in message
news:uG**************@TK2MSFTNGP11.phx.gbl...
Hi all,

I have a application developed in C# .net. The problem I face is I am

unable
to shutdown my machine
when the exe is running. Windows is unable to close this exe an shut down. Can anyone help.
Regards,
Kuldeep Pawar
Programmer,
Maximize Learning, Pune.
www.maximizelearning.com


Nov 15 '05 #3
Have you tried to comment out the Closing event to see if it is the problem?
You can also add a MessageBox.Show("closing"); at the event to see if it is
called on shutdown.

If you successfully trap the WM_QUERYENDSESSION or WM_ENDSESSION messages
you could close the application by code.

HTH
Ciao
Formentz
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5831
by: Claire | last post by:
Running XP pro, SP2. Visual studio .NET 2003. App written in C# I have written an application that hides itself when run and shows a notification icon in the system tray. If the main form is...
3
2910
by: Claire | last post by:
Windows refuses to close down if my applications main form is hidden and there's a notify icon in the system tray. If I restore the form, then shutting down Windows succeeds. If I comment out the...
4
2222
by: Diogo Alves - Software Developer | last post by:
Hi, I have a application developed by me in C# that does not let windows shut down! What is the problem? is this a Framework bug? I would like to receive some feedback about this issue
5
1885
by: Anders Both | last post by:
If no pages in my asp.net web-system, is being requested for some periode, it seems like the asp.net process is shut down automaticaly. Is this a normal behavior, or does my system contains some...
3
1164
by: Michael Persaud | last post by:
.... Can you say shut down a machine with code by clicking on a button in a web page. This would also have to have some user privelage authentication through AD and probally even to a SQl...
1
1834
by: TC | last post by:
I'm confused about the proper way to shut down my application. I have a form which instantiates a control, which instantiates another control, which instantiates yet another control that runs a...
4
4030
by: benjaminkang | last post by:
I'm very new to Coldfusion and action script, but due to job requirements, i got allocated the task of developing a cfm page where the user logs in using the embedded swf file and everything was...
1
3486
by: Cramer | last post by:
I'm running XP Pro/SP2 + patches and updates, with Visual Studio Professional 2008 (and no prior installation of Visual Studio ever installed). When attempting to open an ASP.NET Web application...
1
5178
LoanB
by: LoanB | last post by:
Hello team, I'm building a GIS Silverlight 4 application. I need to shut down the whole thing after a save event has taken place. So.. 1. User saves a new graphic to the SDE database, 2....
0
7108
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.