Ребят вопрос решен, все оказалось просто. Все в кусности есть user32.dll
| Код | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Runtime.InteropServices; using System.IO; // хер его знает нужно или нет...
public class class1 {
[DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int GetWindowText(int hWnd, StringBuilder text, int count); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern IntPtr GetForegroundWindow(); /* * Текст активного окна */ public string GetActiveWindow() { const int cChars = 256; IntPtr ihandler = IntPtr.Zero; StringBuilder sBuff = new StringBuilder(cChars); ihandler = GetForegroundWindow(); if (GetWindowText(ihandler.ToInt32(), sBuff, cChars) > 0) return sBuff.ToString(); return ""; }
}
|
|