From 555488b8bbccce3bc6c6c17d55d3096068975f53 Mon Sep 17 00:00:00 2001 From: Kalakoi Date: Thu, 22 May 2025 14:22:16 -0400 Subject: [PATCH] Added interop support to click through windows. --- osrs-toolbox/APIs/WindowsServices.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 osrs-toolbox/APIs/WindowsServices.cs diff --git a/osrs-toolbox/APIs/WindowsServices.cs b/osrs-toolbox/APIs/WindowsServices.cs new file mode 100644 index 0000000..f977a0e --- /dev/null +++ b/osrs-toolbox/APIs/WindowsServices.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace osrs_toolbox +{ + public static class WindowsServices + { + const int WS_EX_TRANSPARENT = 0x00000020; + const int GWL_EXSTYLE = (-20); + + [DllImport("user32.dll")] + static extern int GetWindowLong(IntPtr hwnd, int index); + + [DllImport("user32.dll")] + static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle); + + public static void SetWindowExTransparent(IntPtr hwnd) + { + var extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE); + SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT); + } + } +}