How to convert IntPtr to int
问题 A window handle sometimes of type int and other times of type IntPtr int example: [DllImport("user32.dll")] static extern uint GetWindowThreadProcessId(int hWnd, int ProcessId); IntPtr example: [DllImport("user32.dll", CharSet = CharSet.Auto)] static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, StringBuilder lParam); I don't seem to be able to convert/cast from one to the other. When I try this.ProcessID = GetWindowThreadProcessId(windowHandle.ToInt32(),0) I get an error