From 239790532df4a66083f3968a81aec1f65145c3ab Mon Sep 17 00:00:00 2001 From: Pariring Date: Sun, 6 Nov 2022 10:48:46 +0900 Subject: [PATCH] feat: example code --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index bc53b46..86c2b9a 100644 --- a/README.md +++ b/README.md @@ -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