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-09-11 23:24:14 发布
本文介绍了如何在C#中利用P/Invoke技术调用Win32 API,详细阐述了步骤和注意事项,并给出了几个实用的例子,帮助开发者实现更底层的功能操作。

最低0.47元/天 解锁文章
4735

被折叠的 条评论
为什么被折叠?



