Desktop App · WPF / .NET 10

AkiMacro

A general-purpose Windows mouse macro tool — two side-button macros driven by a Win32 SendInput engine behind a global input lock.

License MITPlatform Windows 10/11 · 64-bitTech WPF · .NET 10Engine Win32 SendInput
Features

What it does

AkiMacro is a general-purpose mouse macro tool for Windows 10/11, built with WPF and .NET 10. It binds auto rotation and a two-button combo to your mouse side buttons, executed by a Win32 SendInput engine guarded by a global input lock. It requests UAC elevation automatically and follows an MVVM architecture with unit-testable input abstractions.

🖱️

X1 — Auto Rotation

While held, moves the mouse smoothly to the right: 20 ms polling with 20 micro-steps.

⚡

X2 — Two-Button Macro

Left button held, right button tap, release — repeated twice per trigger.

🛡️

Thread safety

A global input lock (InputLock.SyncRoot) ensures only one Worker simulates input at a time.

🔐

Automatic elevation

Checks for administrator privileges at startup and triggers UAC when not running elevated.

⚙️

Error handling

Automatically stops and reports an error when SendInput fails.

🧪

Testable architecture

IInputSimulator and IButtonStateProvider abstractions support dependency injection and xUnit tests.

🎨

Compact WPF shell

Borderless main window with a custom title bar and dark theme, plus About and read-only Settings windows.

Details

Technical architecture

ModuleDescription
InteropWraps the Win32 API
InputInput abstraction layer for easy unit testing
MacroEngineMacro execution engine; manages Worker thread lifecycles
ViewModelsMVVM pattern, keeping UI and business logic separate
Quick Start

Build from source

  1. Requirements — Windows 10/11 (64-bit) and the .NET 10.0 runtime.
  2. Download the latest build from Releases, or build from source with the commands below.
  3. Launch — the program requests UAC elevation automatically at startup.
  4. Quick path — run run.bat to build and launch in one step.
shell
dotnet restore
dotnet build -c Release
dotnet test

dotnet publish AkiMacro.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true

“For learning and entertainment purposes only.”

桌面应用 · WPF / .NET 10

项目简介

AkiMacro 是一款面向 Windows 10/11 的通用鼠标宏工具,基于 WPF 与 .NET 10 构建。它将自动旋转与双键组合宏绑定到鼠标侧键,由 Win32 SendInput 引擎执行,并以全局输入锁保障线程安全。程序启动时自动请求 UAC 提权,采用 MVVM 架构,输入层可单元测试。

🖱️

X1 — 自动旋转

按住时鼠标平滑向右移动:20ms 轮询,20 个微步。

⚡

X2 — 双键宏

左键按住 → 右键点按 → 松开,每次触发循环两次。

🛡️

线程安全

全局输入锁(InputLock.SyncRoot)确保同一时间只有一个 Worker 模拟输入。

🔐

自动提权

启动时检测管理员权限,非管理员运行时自动触发 UAC。

⚙️

错误处理

SendInput 失败时自动停止并上报错误。

🧪

可测试架构

IInputSimulator 与 IButtonStateProvider 抽象支持依赖注入与 xUnit 测试。

🎨

紧凑的 WPF 外壳

无边框主窗口配自定义标题栏与深色主题,另含关于窗口与只读设置窗口。

明细

技术架构

模块说明
Interop封装 Win32 API
Input输入抽象层,便于单元测试
MacroEngine宏执行引擎,管理 Worker 线程生命周期
ViewModelsMVVM 模式,UI 与业务逻辑分离
  1. 系统要求——Windows 10/11(64 位)与 .NET 10.0 运行时。
  2. 下载Releases 中的最新版本,或用下方命令从源码构建。
  3. 启动——程序在启动时自动请求 UAC 提权。
  4. 快速方式——运行 run.bat 一键构建并启动。
shell
dotnet restore
dotnet build -c Release
dotnet test

dotnet publish AkiMacro.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true

“仅供学习和娱乐使用。”