Solved

Close Application Requestion

Posted on 2011-02-16
4
341 Views
Last Modified: 2012-05-11
Hi,

I am developing an application that should be close for another one. I mean, I have my APP1.exe running (could exist only one APP1.exe or a several running at the same time) that must be closed by a command button in APP2.exe.

How can I do that considering the following constraint condition?
1) I do not want to use files
2) I do not want to use queue message
3) I do not want to use any networking?

I tought to use some SendMessage to all APP1.exe running, but how to do that? Any other idea will be welcome as well.

Thanks,

0
Comment
Question by:jr_barros_jr
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 300 total points
ID: 34906944
Hi,

You can do it like this

        Dim objProcess() As Process = System.Diagnostics.Process.GetProcessesByName("App1")

        For Each p As Process In objProcess
            p.Kill()
        Next
0
 
LVL 33

Assisted Solution

by:Todd Gerbert
Todd Gerbert earned 150 total points
ID: 34906976
Using Process.Kill() will forcefully close instances of App1 (which might be okay), or you can use Process.CloseMainWindow() - which has the same effect as if the user had closed the main window of each App1, which means App1 would have a chance to shutdown gracefully.

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.closemainwindow.aspx
0
 
LVL 25

Assisted Solution

by:Luis Pérez
Luis Pérez earned 50 total points
ID: 34906994
Try this:

        Dim processList As Process() = Process.GetProcessesByName("App1")
        For Each uProcess As Process In processList
            uProcess.Kill()
        Next
0
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 34906996
Ooops... too late.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WPF - Tooltips for ComboBox items 5 27
update textboxes with Streamreader 21 42
fso.FolderExists("\\server\HiddenFolder$") 4 46
Connection String 16 41
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now