.NET Program that runs in the background [Answered]
How would I make an .exe program in c# .NET that runs in the background (It will have a tray icon instead). It will be used for capturing certain hotkey presses


Hardcodet.Wpf.TaskbarNotificationRegisterHotKeyWin + VRAWINPUT* WriteRawInputToBufferWM_INPUTThe type or namespace name 'RAWINPUTHEADER' could not be found private static unsafe void RegisterForGlobalRawKeyboardInput(HWND target_window_handle)
{
const ushort HID_USAGE_PAGE_GENERIC = 1;
const ushort HID_USAGE_GENERIC_KEYBOARD = 6;
const int FALSE = 0;
var rawInputDevice = new RAWINPUTDEVICE
{
usUsagePage = HID_USAGE_PAGE_GENERIC,
usUsage = HID_USAGE_GENERIC_KEYBOARD,
dwFlags = RAWINPUTDEVICE_FLAGS.RIDEV_INPUTSINK | RAWINPUTDEVICE_FLAGS.RIDEV_NOLEGACY | RAWINPUTDEVICE_FLAGS.RIDEV_NOHOTKEYS,
hwndTarget = target_window_handle
};
if (RegisterRawInputDevices(&rawInputDevice, 1, (uint)sizeof(RAWINPUTDEVICE)).Value is FALSE) { throw ... }
}
private static unsafe void WriteRawInputToBuffer(RAWINPUT* out_raw_input, LPARAM l)
{
const uint ERROR = unchecked((uint)-1);
var rawInputHandle = (HRAWINPUT)l.Value;
var size = (uint)sizeof(RAWINPUT);
if (GetRawInputData(rawInputHandle, RAW_INPUT_DATA_COMMAND_FLAGS.RID_INPUT, out_raw_input, &size, (uint)sizeof(RAWINPUTHEADER)) is ERROR) { throw ... }
}