Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paring-chan/skyhook-native
Dynamic library of SkyHook. (Mirrored)
https://github.com/paring-chan/skyhook-native
Last synced: 2 days ago
JSON representation
Dynamic library of SkyHook. (Mirrored)
- Host: GitHub
- URL: https://github.com/paring-chan/skyhook-native
- Owner: paring-chan
- Created: 2022-11-12T12:08:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-28T10:05:02.000Z (over 1 year ago)
- Last Synced: 2024-12-31T07:45:56.900Z (3 days ago)
- Language: Rust
- Homepage: https://git.pikokr.dev/SkyHook/SkyHook-Native
- Size: 36.1 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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`](#start_hook) and [`stop_hook`](#stop_hook).
### `start_hook`
```cs
// 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`
```cs
// No additional information required to provide when stopping the hook.
[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; // 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
```sh
git clone https://git.pikokr.dev/SkyHook/SkyHook-Native #Clone
```To build, just run [`build.sh`](build.sh) on Linux or MacOS, [`build.ps1`](build.ps1) on Windows.