WindowsApplication systeem gedeeltelijk verhuisd naar Windows class in het utils pakket.
This commit is contained in:
@@ -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();
|
||||
|
||||
25
java/src/pm/util/Windows.java
Normal file
25
java/src/pm/util/Windows.java
Normal 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});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user