主题
注册鼠标移动快捷键 - RegisterMouseMove
函数简介
注册鼠标移动快捷键监听,可监听鼠标移动坐标。
接口名称
RegisterMouseMoveDLL调用
int RegisterMouseMove(long ola, MouseMoveCallback callback);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| callback | 回调函数 | 回调函数 void MouseMoveCallback(int x, int y),x 为鼠标X坐标,y 为鼠标Y坐标。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int ret = ola.StartHotkeyHook();
if (ret == 1) {
int moveRet = ola.RegisterMouseMove([](int x, int y) {});
}csharp
using OLAPlug;
var ola = new OLAPlugServer();
int ret = ola.StartHotkeyHook();
if (ret == 1)
{
int moveRet = ola.RegisterMouseMove((x, y) => { });
}python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ret = ola.StartHotkeyHook()
if ret == 1:
def on_move(x, y):
pass
move_ret = ola.RegisterMouseMove(on_move)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
int ret = ola.StartHotkeyHook();
if (ret == 1) {
int moveRet = ola.RegisterMouseMove(null);
}cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.StartHotkeyHook()
if(ret == 1) {
var moveRet = ola.RegisterMouseMove(0)
}vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.StartHotkeyHook()
If ret = 1 Then
moveRet = ola.RegisterMouseMove(0)
End Iftext
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.StartHotkeyHook ()
.如果真 (ret = 1)
moveRet = ola.RegisterMouseMove (0)
.如果真结束aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.StartHotkeyHook();
if(ret == 1){
var moveRet = ola.RegisterMouseMove(function(x,y){});
}text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.StartHotkeyHook()
如果真 (ret = 1)
{
整数 moveRet = ola.RegisterMouseMove(0)
}cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int32_t ret = ola.StartHotkeyHook();
if (ret == 1) {
int32_t moveRet = ola.RegisterMouseMove(nullptr);
}原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
StartHotkeyHook(instance);
RegisterMouseMove(instance, 0);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 RegisterMouseMove(long ola, long callback);
long instance = CreateCOLAPlugInterFace();
StartHotkeyHook(instance);
RegisterMouseMove(instance, 0);python
from ctypes import CDLL, c_int, c_int64
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
StartHotkeyHook(instance);
RegisterMouseMove(instance, 0);返回值
整数型。1 成功,0 失败。
注意事项
- 注册前需先调用 StartHotkeyHook 安装键盘鼠标钩子。
- 参考 Windows 函数 SetWindowsHookExW 实现。
