Click here to Skip to main content
Sign Up to vote bad
good
See more: C#4.0
Hello,
I have a windows application that launches IE9 and leaves the window application minimized.
Is there anyway to kill it after launching IE9?
 
Windows App()
{
Launch IE9
Sleep time
Kill Windows App()
}
 
Can someone guide me in how to do it in C#
 
Thanks for your help
Posted 27 Feb '13 - 6:08
namerg384
Edited 27 Feb '13 - 6:10
richcb12.3K


3 solutions

You can google this too, here are some examples,
 
Enviroment.Exit(0);
 
Form.Close();
 
Application.Exit();
  Permalink  
Comments
Johirul Islam Tarun - 28 Feb '13 - 0:08
for Single form : this.Dispose() or this.close(); for The whole application close: Application.Exit()
Hi,
 
Try this:
// launch IE9
// Sleep time
Application.Exit(); // Kill Windows App
 
More information about Application.Exit:
http://msdn.microsoft.com/en-us/library/ms157894.aspx[^]
  Permalink  
The the code example. It will lunch notepad from a windows application then kill that windows application.
 
private void button1_Click(object sender, EventArgs e)
{
    string exeFilePath = @"C:\Windows\System32\notepad.exe";
    Process.Start(exeFilePath);
    Process.GetCurrentProcess().Kill();
}
  Permalink  
Comments
namerg - 27 Feb '13 - 13:07
S.M Thanks but I should not have buttons, just a small plain form. I am using Environment. Exit(0); but I am getting a System.NullReferenceException. I have posted already a question.
S. M. Ahasan Habib - 27 Feb '13 - 23:37
Instead of button click event you can do it Form_Load event.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 325
1 Mohammed Hameed 123
2 Sergey Alexandrovich Kryukov 115
3 Santhosh G_ 103
4 Ron Beyer 89
0 Sergey Alexandrovich Kryukov 8,286
1 OriginalGriff 6,561
2 CPallini 3,533
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid