Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 27-Feb-13 6:10am
v2

You can google this too, here are some examples,

Enviroment.Exit(0);

Form.Close();

Application.Exit();
 
Share this answer
 
Comments
Johirul Islam Tarun 28-Feb-13 0:08am    
for Single form : this.Dispose() or this.close();

for The whole application close: Application.Exit()
Hi,

Try this:
C#
// launch IE9
// Sleep time
Application.Exit(); // Kill Windows App


More information about Application.Exit:
http://msdn.microsoft.com/en-us/library/ms157894.aspx[^]
 
Share this answer
 
v2
The the code example. It will lunch notepad from a windows application then kill that windows application.

C#
private void button1_Click(object sender, EventArgs e)
{
    string exeFilePath = @"C:\Windows\System32\notepad.exe";
    Process.Start(exeFilePath);
    Process.GetCurrentProcess().Kill();
}
 
Share this answer
 
Comments
namerg 27-Feb-13 13:07pm    
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:37pm    
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900