主题
卸载键盘快捷键 - UnregisterHotkey
函数简介
卸载已注册的键盘快捷键监听。
接口名称
UnregisterHotkeyDLL调用
int UnregisterHotkey(long ola, int keycode, int modifiers);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| keycode | 整数型 | 按键码。 |
| modifiers | 整数型 | 修饰键组合,使用位或组合,如 Ctrl+Alt 为 2+8=10。取值:左Shift(1)、左Ctrl(2)、左Meta(4)、左Alt(8)、右Shift(16)、右Ctrl(32)、右Meta(64)、右Alt(128)。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int ret = ola.StartHotkeyHook();
if (ret == 1) {
ola.RegisterHotkey(120, 10, nullptr);
ola.UnregisterHotkey(120, 10);
}csharp
using OLAPlug;
var ola = new OLAPlugServer();
int ret = ola.StartHotkeyHook();
if (ret == 1)
{
ola.RegisterHotkey(120, 10, (k, m) => 0);
ola.UnregisterHotkey(120, 10);
}python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ret = ola.StartHotkeyHook()
if ret == 1:
ola.RegisterHotkey(120, 10, lambda k, m: 0)
ola.UnregisterHotkey(120, 10)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
int ret = ola.StartHotkeyHook();
if (ret == 1) {
ola.UnregisterHotkey(120, 10);
}cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.StartHotkeyHook()
if(ret == 1) {
ola.RegisterHotkey(120, 10, 0)
ola.UnregisterHotkey(120, 10)
}vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.StartHotkeyHook()
If ret = 1 Then
ola.RegisterHotkey(120, 10, 0)
ola.UnregisterHotkey(120, 10)
End Iftext
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.StartHotkeyHook ()
.如果真 (ret = 1)
ola.RegisterHotkey (120, 10, 0)
ola.UnregisterHotkey (120, 10)
.如果真结束aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.StartHotkeyHook();
if(ret == 1){
ola.RegisterHotkey(120, 10, function(k,m){return 0;});
ola.UnregisterHotkey(120, 10);
}text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.StartHotkeyHook()
如果真 (ret = 1)
{
ola.RegisterHotkey(120, 10, 0)
ola.UnregisterHotkey(120, 10)
}cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int32_t ret = ola.StartHotkeyHook();
if (ret == 1) {
ola.UnregisterHotkey(120, 10);
}原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
StartHotkeyHook(instance);
RegisterHotkey(instance, 120, 10, 0);
UnregisterHotkey(instance, 120, 10);csharp
using System.Runtime.InteropServices;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int StartHotkeyHook(long ola);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int RegisterHotkey(long ola, int keycode, int modifiers, long callback);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int UnregisterHotkey(long ola, int keycode, int modifiers);
long instance = CreateCOLAPlugInterFace();
StartHotkeyHook(instance);
RegisterHotkey(instance, 120, 10, 0);
UnregisterHotkey(instance, 120, 10);python
from ctypes import CDLL, c_int, c_int64
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
StartHotkeyHook(instance);
RegisterHotkey(instance, 120, 10, 0);
UnregisterHotkey(instance, 120, 10);返回值
整数型。1 成功,0 失败。
