Talrijke aanpassingen gemaakt. Vorige commit gaf een fout en ik heb geen zin om informatie opnieuw te typen.

This commit is contained in:
2011-02-20 12:36:53 +00:00
parent 757d4f3868
commit b77e280343
26 changed files with 704 additions and 60 deletions

View File

@@ -0,0 +1,25 @@
package pm.util;
import java.io.File;
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Native {
public static int getHandle(String name) throws IOException {
File file = new File("native/list.exe");
Process process = Runtime.getRuntime().exec(file.getPath());
Scanner scanner = new Scanner(process.getInputStream());
while (scanner.hasNextLine()) {
try {
int handle = new Integer(scanner.nextLine());
String title = scanner.nextLine();
if (title.contains(name)) {
System.out.println("Window (" + handle + "): \"" + title + "\"");
return handle;
}
} catch (InputMismatchException e) {}
}
return -1;
}
}