|
-
Jan 20th, 2006, 02:54 PM
#1
Thread Starter
Addicted Member
Another Taskmananger question
If I have a program that is designed to close all programs of a certain name, is there a way I can prevent it from closing itself if it has that same name. Like for example with my program you can run it as many times as you want. Each copy of the program has code to close all processes that are its name. The thing is that when I do this, sometimes it ends up closing the program that is calling it and then they all don't get closed. Is there a way I can close all of the other programs then close the one thats calling it?
-
Jan 20th, 2006, 05:53 PM
#2
Re: Another Taskmananger question
You can try something like comparing the main window handle of the process, see if it is equal to the handle you are working in (I am assuming this code would only work if you are running it from the main application window... not a child window of the application...
VB Code:
Dim px() As Process = Process.GetProcesses
For Each proc As Process In px
If Not proc.MainWindowHandle.ToInt32 = Me.Handle.ToInt32 Then
proc.CloseMainWindow()
Else
MessageBox.Show("The app is me!")
End If
Next
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|