-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utils.cs
28 lines (25 loc) · 924 Bytes
/
Utils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Text;
using Nostrum.WinAPI;
namespace GuitarRigLauncher
{
public static class Utils
{
public static string GetWindowTitle(IntPtr hwnd)
{
var sb = new StringBuilder(256);
User32.GetWindowText(hwnd, sb, 256);
return sb.ToString();
}
public static void MakeWindowUnfocusable(IntPtr win)
{
var newStyle = User32.GetWindowLong(win, (int)User32.GWL.GWL_EXSTYLE) | (int)User32.ExtendedWindowStyles.WS_EX_NOACTIVATE;
User32.SetWindowLong(win, (int)User32.GWL.GWL_EXSTYLE, newStyle);
}
public static void MakeWindowFocusable(IntPtr win)
{
var newStyle = User32.GetWindowLong(win, (int)User32.GWL.GWL_EXSTYLE) & ~(uint)User32.ExtendedWindowStyles.WS_EX_NOACTIVATE;
User32.SetWindowLong(win, (int)User32.GWL.GWL_EXSTYLE, newStyle);
}
}
}