Unable to extract processID from GetProcessId(.. hWnd) (pInvoke)
问题 im using the following method [DllImport("kernel32.dll", SetLastError=true)] static extern int GetProcessId(IntPtr hWnd); to try and get the processId for a running process and the only information I have is the HWND. My problem is that it is always returning error code 6 which is ERROR_INVALID_HANDLE. I thought i might change the parameter to be of type int but that also didnt work. Im not able to enumerate the running processes because there may be more than 1 instance running at any one