TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nageswararao Dhulipalla
NA
77
0
How to close/Kill the already opened Main winform in C#
Oct 10 2011 2:32 AM
Hi,
I need to Close / Kill the already opened Main Winform application through C# coding, and will sopport all the operatingg system (Win 7 32 & 64 bit, Vista 32 & 64 Bit etc).
I already tried the below code but some times it didn't work in XP.
And rest OS this is not working. Please find below code:
Process thisProc = null;
string processName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
foreach (Process openedProcesses in Process.GetProcesses())
{
if (openedProcesses.ProcessName.Contains(processName))
{
thisProc = openedProcesses;
thisProc.CloseMainWindow();
thisProc.Kill();
}
}
Thanks in Adavance.
Reply
Answers (
2
)
Session and SessionID
Parallelizing method with foreach loop C#