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 4e0d4007fe
fix: syntax error
2022-12-08 00:14:20 +09:00
src fix: syntax error 2022-12-08 00:14:20 +09:00
vendor chore: update submodule 2022-12-07 23:53:09 +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: use chrono NaiveDateTime 2022-12-01 17:14:47 +09:00
README.md chore: fix a typo in README 2022-11-26 17:07:00 +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 or MacOS, build.ps1 on Windows.