请问关于
handle OpenProcess(dword dwDesiredAccess, // 访问标志bool bInheritHandle, // 句柄继承选项dword dwProcessId // 进程ID);
里头,dwDesiredAccess如何定义,dwProcessId 如何获取呢???请给个完整例子,谢谢!

解决方案 »

  1.   

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/openprocess.aspdwProcessId可以用GetWindowThreadProcessId来获取,也可以用CreateToolhelp32Snapshot创建进程快照来获取。例子见上面msdn的连接。
      

  2.   

    建议你使用.net中的Process这个类来实现你的功能。
    例如,使用Process.GetProcesses之类的方法。如果你想知道这两个参数具体从哪儿获得,参看msdn中解释就行。
      

  3.   

    请问,为什么我在
    public static extern IntPtr FindWindow(string IpClassName,string IpWindowName);
    中得到的句柄和在spy++中看到的句柄不一样呢???
    public static extern IntPtr FindWindow(string IpClassName,string IpWindowName);
    得到的句柄是:2229260
    在spy++中看见的句柄是:0022040c
      

  4.   

    to 请问,为什么我在
    public static extern IntPtr FindWindow(string IpClassName,string IpWindowName);
    中得到的句柄和在spy++中看到的句柄不一样呢???yun~2229260 == 0x0022040c一个是十进制,一个是16进制。