有人用过JNative的user32.regitsterhotkey吗?

jinceon 发布于 2011/06/26 10:06
阅读 350
收藏 0
public static boolean RegisterHotKey(HWND hWnd,
 int id,
 int fsModifiers,
 int vk)
 throws NativeException, IllegalAccessException
 {
 JNative RegisterHotKey = new JNative(DLL_NAME, "RegisterHotKey");
 RegisterHotKey.setRetVal(Type.INT);
 int pos = 0;
 RegisterHotKey.setParameter(pos++, hWnd.getValue());
 RegisterHotKey.setParameter(pos++, id);
 RegisterHotKey.setParameter(pos++, fsModifiers);
 RegisterHotKey.setParameter(pos++, vk);
 
 RegisterHotKey.invoke();
 
 pos = RegisterHotKey.getRetValAsInt();
 
 RegisterHotKey.dispose();
 
 return (pos != 0);
 }
 
 
 public static boolean UnregisterHotKey(HWND hWnd, int id) throws NativeException, IllegalAccessException
 {
 JNative UnregisterHotKey = new JNative(DLL_NAME, "UnregisterHotKey");
 UnregisterHotKey.setRetVal(Type.INT);
 int pos = 0;
 UnregisterHotKey.setParameter(pos++, hWnd.getValue());
 UnregisterHotKey.setParameter(pos++, id);
 UnregisterHotKey.invoke();
 pos = UnregisterHotKey.getRetValAsInt();
 
 UnregisterHotKey.dispose();
 
 return (pos != 0);
 }

烦躁中。

加载中
返回顶部
顶部