This repository has been archived on 2023-05-28. You can view files and clone it, but cannot push or open issues/pull-requests.
2022-11-03 18:58:31 +09:00
|
|
|
# SkyHook-Native
|
2022-11-05 11:37:27 +09:00
|
|
|
|
|
|
|
dynamic library of SkyHook for use with other languages
|
|
|
|
|
2022-11-06 10:48:46 +09:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
The following examples are all in C#
|
|
|
|
|
|
|
|
### Functions
|
|
|
|
|
|
|
|
The exported functions are simple. Just `start_hook` and `stop_hook`
|
|
|
|
|
|
|
|
### start_hook
|
|
|
|
|
|
|
|
```cs
|
2022-11-06 12:23:25 +09:00
|
|
|
public static delegate void HookCallback(NativeEvent ev);
|
2022-11-06 10:48:46 +09:00
|
|
|
|
|
|
|
[DllImport("skyhook", EntryPoint = "start_hook")]
|
|
|
|
public static extern void StartHook(HookCallback callback);
|
|
|
|
```
|
|
|
|
|
|
|
|
### stop_hook
|
|
|
|
|
|
|
|
```cs
|
|
|
|
[DllImport("skyhook", EntryPoint = "stop_hook")]
|
|
|
|
public static extern void StopHook();
|
|
|
|
```
|
|
|
|
|
|
|
|
### Types
|
|
|
|
|
|
|
|
### NativeEventType
|
|
|
|
|
|
|
|
```cs
|
|
|
|
public enum NativeEventType {
|
|
|
|
KeyPressed,
|
|
|
|
KeyReleased
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### NativeEvent
|
|
|
|
|
|
|
|
```cs
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
public struct NativeEvent
|
|
|
|
{
|
|
|
|
public readonly ulong Time;
|
|
|
|
public readonly EventType Type;
|
|
|
|
public readonly uint Key;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-11-05 11:37:27 +09:00
|
|
|
## Development
|
|
|
|
|
|
|
|
```sh
|
|
|
|
git clone https://git.pikokr.dev/SkyHook/SkyHook-Native #Clone
|
|
|
|
```
|
|
|
|
|
|
|
|
to build, just run `build.sh` on Linux of MacOS, `build.ps1` on Windows
|