mirror of
https://github.com/mitb-archive/filebot
synced 2024-08-13 17:03:45 -04:00
35 lines
874 B
Java
35 lines
874 B
Java
package net.filebot.win;
|
|
|
|
import static net.filebot.Logging.*;
|
|
|
|
import java.util.logging.Level;
|
|
|
|
import com.sun.jna.WString;
|
|
import com.sun.jna.platform.win32.Shell32;
|
|
import com.sun.jna.platform.win32.WinError;
|
|
import com.sun.jna.ptr.PointerByReference;
|
|
|
|
public class WinAppUtilities {
|
|
|
|
public static void setAppUserModelID(String appID) {
|
|
try {
|
|
Shell32.INSTANCE.SetCurrentProcessExplicitAppUserModelID(new WString(appID));
|
|
} catch (Throwable t) {
|
|
debug.log(Level.WARNING, t.getMessage(), t);
|
|
}
|
|
}
|
|
|
|
public static String getAppUserModelID() {
|
|
try {
|
|
PointerByReference ppszAppID = new PointerByReference();
|
|
if (Shell32.INSTANCE.GetCurrentProcessExplicitAppUserModelID(ppszAppID) == WinError.S_OK) {
|
|
return ppszAppID.getValue().getWideString(0);
|
|
}
|
|
} catch (Throwable t) {
|
|
debug.log(Level.WARNING, t.getMessage(), t);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
}
|