WindowsApplication systeem gedeeltelijk verhuisd naar Windows class in het utils pakket.

This commit is contained in:
2011-02-22 21:03:57 +00:00
parent 88c849ff89
commit 3c1f96db46
5 changed files with 58 additions and 46 deletions

View File

@@ -37,7 +37,8 @@ public class Native {
}
public static String getValue(String key, String name) throws IOException {
Process process = Runtime.getRuntime().exec("reg query " + key);
String command = String.format("reg query \"%s\"", key);
Process process = Runtime.getRuntime().exec(command);
Scanner processScanner = new Scanner(process.getInputStream());
try {
processScanner.nextLine();

View File

@@ -0,0 +1,25 @@
package pm.util;
import com.eaio.nativecall.IntCall;
public class Windows {
protected static IntCall findWindow;
protected static IntCall sendMessage;
protected static IntCall postMessage;
protected static IntCall mapVirtualKey;
static {
findWindow = new IntCall("user32", "FindWindowA");
sendMessage = new IntCall("user32", "SendMessageA");
postMessage = new IntCall("user32", "PostMessageA");
mapVirtualKey = new IntCall("user32", "MapVirtualKeyA");
}
public static int findWindow(String className, String windowName) {
return findWindow.executeCall(new Object[] {className, windowName});
}
public static boolean postMessage(int handle, int message, int wParam, int lParam) {
return postMessage.executeBooleanCall(new Object[] {handle, message, wParam, lParam});
}
}