(no subject)
Aug. 29th, 2009 01:00 pmthe biggest problem with .NET still seems to be the reduced functionality of the [safe] managed libraries vice [unsafe] P/Invoke. take, for example, FindWindow: you can specify the window's class, its title[/caption], or both, and get back a singular result. the nearest .NET-native equivalent is System.Diagnostics.Process.GetProcessesByName, which takes a
oh, but apparently you can duplicate the behavior of FindWindow: you just call System.Diagnostics.Process.GetProcesses and iterate through every process on the machine! seriously: what? and it gets even better, because apparently Process instances aren't necessarily destroyed once they complete. so part of that array may not even exist anymore.
process name(the executable filename, limited to 15 characters) and optionally a remote machine name/address (?!), and returns an array of matching processes. alternatively you can use System.Diagnostics.Process.GetProcessById - if you know the [locally unique, dynamically assigned] numeric process ID.
oh, but apparently you can duplicate the behavior of FindWindow: you just call System.Diagnostics.Process.GetProcesses and iterate through every process on the machine! seriously: what? and it gets even better, because apparently Process instances aren't necessarily destroyed once they complete. so part of that array may not even exist anymore.