public class WinAPIManager
{
[DllImport("user32.dll")]
public static extern bool SetWindowText(IntPtr hwnd, String lpStrjng);
[DllImport("user32.dll")]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
//获取桌面窗口句柄
[DllImport("user32.dll", EntryPoint = "GetDesktopWindow")]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
public static extern IntPtr GetWindow(IntPtr hWnd, int cmd);
[DllImport("User32.dll", EntryPoint = "GetWindowRect", CharSet = CharSet.Auto)]
public static extern bool GetWindowRect(IntPtr hWnd, out System.Drawing.Rectangle lpRect);
[DllImport("kernel32", EntryPoint = "GetPrivateProfileString")]
public static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
[DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)]
// 函数说明:在窗口列表中寻找与指定条件相符的第一个子窗口
C# 使用Win32 API的一些方法
最新推荐文章于 2024-07-11 17:57:12 发布