主题
开启键鼠同步采集 - EnableInputSync
函数简介
开启或关闭本实例的键鼠同步采集。开启后:
- 宿主对本实例的
KeyDown/MoveTo/MoveR/ 点击等 API 写入事件总线; - DX 绑定且前台锁定关闭时,额外回传前台真人输入(
FG_REAL)。
可与 InputRecord、InputSyncLink、SetInputMonitor 同时使用。InputRecord(START) 在未开启时会自动 Enable。
需要 InputSync 权限(OLA / OLAPlus / OLAUltra)。
接口名称
EnableInputSyncDLL调用
c
int EnableInputSync(long instance, int enable);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| enable | 整数型 | 非 0 开启;0 关闭。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
ola.EnableInputSync(1);csharp
using OLAPlug;
var ola = new OLAPlugServer();
ola.EnableInputSync(1);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ola.EnableInputSync(1)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
ola.EnableInputSync(1);go
import "github.com/ola/olaplug/olaplug"
ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
ola.EnableInputSync(1)rust
use olaplug::OLAPlugServer;
let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
ola.enable_input_sync(1);cpp
var ola = com("OlaPlug.OlaSoft")
ola.EnableInputSync(1);vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ola.EnableInputSync(1)text
.局部变量 ola, OLAPlug
ola.创建 ()
ola.EnableInputSync(1)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
ola.EnableInputSync(1);text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
ola.EnableInputSync(1);cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
ola.EnableInputSync(1);原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
EnableInputSync(instance, 1);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 EnableInputSync(long instance, int enable);
long instance = CreateCOLAPlugInterFace();
EnableInputSync(instance, 1);python
from ctypes import CDLL, c_int64
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ola.EnableInputSync(instance, 1)返回值
| 返回值 | 说明 |
|---|---|
1 | 成功。 |
0 | 失败(无效实例或无权限)。 |
