This repository has been archived on 2023-05-28. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
Go to file
paring fe9e617d99 fix: build script 2022-11-13 15:48:46 +09:00
src refactor: rename event field 2022-11-06 23:25:17 +09:00
vendor chore: update submodule 2022-11-08 18:04:20 +09:00
.gitignore chore: add .DS_Store to gitignore 2022-11-03 23:51:04 +09:00
.gitmodules Initial commit 2022-11-03 18:58:31 +09:00
Cargo.toml feat: setup as shared library 2022-11-03 19:00:47 +09:00
README.md fix: header link in README 2022-11-07 13:28:36 +09:00
build.ps1 chore: add build script for windows 2022-11-05 00:53:54 +09:00
build.sh fix: build script 2022-11-13 15:48:46 +09:00
setup-targets.sh chore: add darwin aarch64 target 2022-11-03 23:51:14 +09:00

README.md

SkyHook-Native

Dynamic library of SkyHook for use with other languages.

Usage

The following examples are all in C#.

Functions

The extern functions that you should run are simple.

There are just two; start_hook and stop_hook.

start_hook

// Here, we assign a callback along with starting a hook.
// The NativeEvent type is declared below "Types" header.
public static delegate void HookCallback(NativeEvent ev);

// Here, we have an extern method to invoke.
[DllImport("skyhook", EntryPoint = "start_hook")]
public static extern void StartHook(HookCallback callback);

stop_hook

// No additional information required to provide when stopping the hook.
[DllImport("skyhook", EntryPoint = "stop_hook")]
public static extern void StopHook();

Types

NativeEventType

public enum NativeEventType {
    KeyPressed,
    KeyReleased
}

NativeEvent

[StructLayout(LayoutKind.Sequential)]
public struct NativeEvent
{
    public readonly ulong Time; // This is the key state update time.
    public readonly NativeEventType Type; // Whether the key is up or down.
    public readonly ushort Label; // Unified label for keys, such as ESC or F11.
    public readonly ushort Key; // Actual key code from native level.
}

Development

git clone https://git.pikokr.dev/SkyHook/SkyHook-Native #Clone

To build, just run build.sh on Linux of MacOS, build.ps1 on Windows.