变量a的值是句柄,怎样得到PID?(让pid被赋为b的值)

解决方案 »

  1.   


            //获取与指定窗口关联在一起的一个进程和线程标识符
            [DllImport("user32", EntryPoint = "GetWindowThreadProcessId")]
            private static extern int GetWindowThreadProcessId(int hwnd,
                                                               out int lpdwProcessId);
    int b;                     //进程标识
    GetWindowThreadProcessId(a, out b);