Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Window.cs
Go to the documentation of this file.
1using System;
2using System.Runtime.InteropServices;
3using System.Text;
4
5namespace B83.Win32;
6
7public static class Window
8{
9 [DllImport("user32.dll")]
10 public static extern bool EnumThreadWindows(uint dwThreadId, EnumThreadDelegate lpfn, IntPtr lParam);
11
12 [DllImport("user32.dll", SetLastError = true)]
13 public static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
14
15 [DllImport("user32.dll")]
16 public static extern bool IsWindowVisible(IntPtr hWnd);
17
18 [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
19 private static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
20
21 public static string GetClassName(IntPtr hWnd)
22 {
23 StringBuilder stringBuilder = new StringBuilder(256);
24 int className = GetClassName(hWnd, stringBuilder, 256);
25 return stringBuilder.ToString(0, className);
26 }
27
28 [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
29 private static extern int GetWindowTextLength(IntPtr hWnd);
30
31 [DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
32 private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
33
34 public static string GetWindowText(IntPtr hWnd)
35 {
36 int num = GetWindowTextLength(hWnd) + 2;
37 StringBuilder stringBuilder = new StringBuilder(num);
38 int windowText = GetWindowText(hWnd, stringBuilder, num);
39 return stringBuilder.ToString(0, windowText);
40 }
41}
static bool GetWindowRect(IntPtr hwnd, out RECT lpRect)
static int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount)
static string GetWindowText(IntPtr hWnd)
Definition: Window.cs:34
static string GetClassName(IntPtr hWnd)
Definition: Window.cs:21
static int GetWindowTextLength(IntPtr hWnd)
static bool IsWindowVisible(IntPtr hWnd)
static bool EnumThreadWindows(uint dwThreadId, EnumThreadDelegate lpfn, IntPtr lParam)
static int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount)
delegate bool EnumThreadDelegate(IntPtr Hwnd, IntPtr lParam)