feat: example code
parent
ba13cf171c
commit
239790532d
47
README.md
47
README.md
|
@ -2,6 +2,53 @@
|
||||||
|
|
||||||
dynamic library of SkyHook for use with other languages
|
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
|
## Development
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
Reference in New Issue