feat: example code

fix/data-structure
paring 2022-11-06 10:48:46 +09:00
parent ba13cf171c
commit 239790532d
Signed by: pikokr
GPG Key ID: 2C097B03E9D823C4
1 changed files with 47 additions and 0 deletions

View File

@ -2,6 +2,53 @@
dynamic library of SkyHook for use with other languages
## Usage
The following examples are all in C#
### Functions
The exported functions are simple. Just `start_hook` and `stop_hook`
### start_hook
```cs
public static delegate void HookCallback(NativeEvent event);
[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;
}
```
## Development
```sh