Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: Get the processid of already running application
|
Posted: Apr 24, 2002 12:33 PM
|
|
On Windows, you use these API calls: CreateToolhelp32Snapshot(), Process32First(), Process32Next().
You could make a single JNI call that uses all three to put together a process list and return it, or you could create three analogous native methods.
Of course, you need to be more specific about what data you want in the list and what you intend to do with it. For instance, if you intend to do some manipulation or monitoring of processes, they you will need their process IDs (and probably more native methods for the other things you intend to do). If all you want to do is display a list of names, or see if a particular process is running, then you don't need so much detail (in fact, you could have a very simple native method called isProcessRunning() or something like that).
|
|