今天遇到一个问题,就是我想获得线程ID,但是GetWindowThreadProcessId()的第二个参数我该怎么写?我写null但是有错误,谢谢解答!
解决方案 »
- c# 手动POST 数据到网站 登陆http的正常,https的就错误:无法连接到远程服务器
- 怎样在C#中调用C++动态库结构体函数得到所有结构体信息?
- 为什么DLL 没法调用WebService,打不到类
- 各位讨论一下Remoting吧, 为什么我的Remotion放在互联网上运行速度那么慢?
- 如何调用word察看一个指定的word文档?(不知道office版本)
- 各位大虾!救命哟,关于WINDOWS服务定时发送邮件的问题!
- 高手们,请教个问题,关于Pinvoke的
- 如何实现在ASP应用程序中实现确认消息框
- 学c#的初级问题
- C#解析二维码失败(使用的是ThoughtWorks)
- C# 本地存储问题 新手问题 求轻喷
- 接口是值类型还是引用类型?刚写了个程序,大家都来参考下
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID); [DllImport("user32.dll", EntryPoint = "FindWindow")]
private extern static IntPtr FindWindow(string lpClassName, string lpWindowName); static void Main(string[] args)
{
IntPtr hwnd = FindWindow(null, "计算器");
if (hwnd != IntPtr.Zero)
{
int calcID;
//获取进程ID
GetWindowThreadProcessId(hwnd, out calcID);
}
}
还是有错误:Error 2 Argument 2 must be passed with the 'out' keyword
还是有错误:Error 2 Argument 2 must be passed with the 'out' keyword
不好意思,我错了,我看走眼了,解决了!!谢谢