Process.CloseMainWindow()

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to force a window to close without displaying a popup asking:
"Windows cannot end this program....If you choose to end the program
immediately, you will lose any unsaved data."

This is a process I am calling and controlling through the code, but I
defiantely want the process to close the window without any user
intervention. Can I force this to close?

The Process.CloseMainWindow() does not seem to have any overrides that will
simulate the "End Now" button.

Thanks
Andy
 
Is there a way to force a window to close without displaying a popup asking:
"Windows cannot end this program....If you choose to end the program
immediately, you will lose any unsaved data."

This is a process I am calling and controlling through the code, but I
defiantely want the process to close the window without any user
intervention. Can I force this to close?

That would be Process.Kill() then if you want to kill the process. Not very
clean though. You could try to close it normally, then wait a few seconds
for it to close and kill it eventually if it really refuses to close by
itself. Sounds better to me.
 
Hi,

Process.Kill is your answer, note that this does nothing to allow the
process to terminate in a nice way.

Process.CloseMainWindow should be prefered.
 
Thanks for the suggestion, but the odd thing is: when I use Process.Kill,
the main window does not close, but remains open, which is why I was trying
to use the CloseMainWindow() method.

For some reason: when I issue a Process.Kill, the process itself is killed,
but the user window remains open, which is causing an issue.

Thanks
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top