Skip to content

Instantly share code, notes, and snippets.

@sparksbat
sparksbat / ProcessUtils.cs
Created October 24, 2017 21:23
C# Get Foreground Process
using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace FGWindow
{
class ProcessUtils
{
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();