我正在尝试获取进程的句柄,但我收到一条错误消息“拒绝访问”。这是我的代码:
namespace Program
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
IntPtr sign = Process.GetProcessesByName("thatProgram")[0].Handle;
}
}
}
似乎这适用于除此特定程序之外的所有程序。你能帮我吗?