mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2025-12-06 07:12:01 +01:00
Add NeptuneController support (kind of works) Add Neptune controller directly from hidapi (to reduce rate of requests) Add README
28 lines
758 B
C#
28 lines
758 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace PowerControl.Helpers
|
|
{
|
|
public class TopLevelWindow
|
|
{
|
|
[DllImport("user32.dll", SetLastError= true)]
|
|
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
|
|
|
[DllImport("user32.dll")]
|
|
public static extern IntPtr GetForegroundWindow();
|
|
|
|
public static uint? GetTopLevelProcessId()
|
|
{
|
|
var hWnd = GetForegroundWindow();
|
|
var result = GetWindowThreadProcessId(hWnd, out uint processId);
|
|
if (result != 0)
|
|
return processId;
|
|
return null;
|
|
}
|
|
}
|
|
}
|