public static partial IntPtr ulCreateKeyEvent( ULKeyEventType type, ULKeyEventModifiers modifiers, int virtual_key_code, int native_key_code, [MarshalUsing(typeof(ULStringGeneratedDllImportMarshaler))] string text, [MarshalUsing(typeof(ULStringGeneratedDllImportMarshaler))] string unmodified_text, [MarshalAs(UnmanagedType.I1)] bool is_keypad, [MarshalAs(UnmanagedType.I1)] bool is_auto_repeat, [MarshalAs(UnmanagedType.I1)] bool is_system_key);
/// <param name="type">Type of event</param> /// <param name="modifiers">Modifiers</param> /// <param name="virtual_key_code"><see cref="ULKeyCodes"/></param> /// <param name="native_key_code">Native key code, set it to 0, if you don't know where get it</param> /// <param name="text">Text generated by keyboard, usually single character</param> /// <param name="unmodified_text">set it to same value as "text"</param> /// <param name="is_keypad">Is Key Pad event</param> /// <param name="is_auto_repeat">Enable autorepeat</param> /// <param name="is_system_key">Is system key<br/>Windows only</param> public ULKeyEvent(ULKeyEventType type, ULKeyEventModifiers modifiers, int virtual_key_code, int native_key_code, string text, string unmodified_text, bool is_keypad, bool is_auto_repeat, bool is_system_key) { // prevent AccessViolationException if (text is null) { throw new ArgumentNullException(nameof(text)); } Ptr = Methods.ulCreateKeyEvent(type, modifiers, virtual_key_code, native_key_code, text, unmodified_text, is_keypad, is_auto_repeat, is_system_key); }
/// <summary> /// Create <see cref="ULKeyEvent"/> from Windows event /// </summary> public ULKeyEvent(ULKeyEventType type, UIntPtr wparam, IntPtr lparam) { // prevent EntryPointNotFoundException #if !NETFRAMEWORK if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { throw new PlatformNotSupportedException("Windows only"); } #endif Ptr = Methods.ulCreateKeyEventWindows(type, wparam, lparam); }
public static IntPtr ulCreateKeyEventWindows(ULKeyEventType type, UIntPtr wparam, IntPtr lparam) { IntPtr ul = NativeLibrary.Load("Ultralight"); IntPtr ulCreateKeyEventWindows__C = NativeLibrary.GetExport(ul, "ulCreateKeyEventWindows"); IntPtr retVal; unsafe { delegate * unmanaged[Cdecl] < ULKeyEventType, UIntPtr, IntPtr, IntPtr > @delegate = (delegate * unmanaged[Cdecl] < ULKeyEventType, UIntPtr, IntPtr, IntPtr >)ulCreateKeyEventWindows__C; retVal = @delegate(type, wparam, lparam); } NativeLibrary.Free(ul); return(retVal); }
public static extern IntPtr ulCreateKeyEventWindows(ULKeyEventType type, UIntPtr wparam, IntPtr lparam);
public static extern C_KeyEvent *ulCreateKeyEventWindows(ULKeyEventType type, [NativeTypeName("uintptr_t")] UIntPtr wparam, [NativeTypeName("intptr_t")] IntPtr lparam, bool is_system_key);
public static extern C_KeyEvent *ulCreateKeyEvent(ULKeyEventType type, [NativeTypeName("unsigned int")] uint modifiers, int virtual_key_code, int native_key_code, [NativeTypeName("ULString")] C_String *text, [NativeTypeName("ULString")] C_String *unmodified_text, bool is_keypad, bool is_auto_repeat, bool is_system_key);
public static extern ULKeyEvent ulCreateKeyEventWindows(ULKeyEventType type, UIntPtr wparam, IntPtr lparam, bool is_system_key);
public static extern ULKeyEvent ulCreateKeyEvent(ULKeyEventType type, uint modifiers, int virtual_key_code, int native_key_code, ULString text, ULString unmodified_text, bool is_keypad, bool is_auto_repeat, bool is_system_key);