c#怎么获得屏幕上的句柄
可以使用Win32 API函数来获取屏幕上的句柄,具体步骤如下:
- 引入Win32 API函数库
using System.Runtime.InteropServices;
- 定义Win32 API函数
[DllImport("user32.dll")] public static extern IntPtr GetDesktopWindow();
- 调用Win32 API函数获取句柄
IntPtr desktopHandle = GetDesktopWindow();
通过以上步骤,可以获取到屏幕的句柄。如果需要获取其他窗口的句柄,可以使用类似的方式,调用相应的Win32 API函数来实现。
原文地址: https://www.cveoy.top/t/topic/fhWs 著作权归作者所有。请勿转载和采集!