|
-
Jan 22nd, 2006, 08:14 PM
#1
Thread Starter
Addicted Member
Closing programs code isn't behaving correctly
hey. I'm having some trouble with the code to close programs. heres what I have for my code so far:
Dim px() As Process = System.Diagnostics.Process.GetProcesses 'gets processes running
'gets number of DuckySE processes
For Each Proc As Process In px 'loops through all processes, finding the name we want
If Proc.ProcessName = "myProgram" And Not Proc.MainWindowHandle.ToInt32 = Me.Handle.ToInt32 Then 'used so doesnt close self
Proc.CloseMainWindow()
End If
Next
The problem is that it only closes some of the time! When I have this in a command button, it can find all the processes but it just doesn't close them. I dont have anything thats preventing it from closing in the form_closing of the applications either. Does the window have to be infocus or something? any ideas? .kill() works, but id like the other other one to work cause then it closes correctly....
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
|