Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 7:08am
namerg408
Edited 27-Feb-13 7:10am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can google this too, here are some examples,
 
Enviroment.Exit(0);
 
Form.Close();
 
Application.Exit();
  Permalink  
Comments
Johirul Islam Tarun at 28-Feb-13 0:08am
   
for Single form : this.Dispose() or this.close();
 
for The whole application close: Application.Exit()
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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 at 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 at 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)



Advertise | Privacy | Mobile
Web01 | 2.8.150305.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100