Add simple function to get a specified processes main Window as an instance of Wnd32

This commit is contained in:
CreepyCrafter24 2020-01-08 17:06:10 +01:00
parent 2c26188fd9
commit 1b59434855
1 changed files with 3 additions and 0 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
@ -19,6 +20,8 @@ namespace CC_Functions.W32
public static Wnd32 fromHandle(IntPtr handle) => new Wnd32(handle);
public static Wnd32 getProcessMain(Process process) => fromHandle(process.MainWindowHandle);
public static Wnd32 fromMetadata(string lpClassName = null, string lpWindowName = null) =>
fromHandle(FindWindow(lpClassName, lpWindowName));