public static int GetWindowThreadId(IntPtr windowHandle)
{
// Check if the handle is valid
HandleManipulator.ValidateAsArgument(windowHandle, "windowHandle");
// Get the thread id
int trash;
return NativeMethods.GetWindowThreadProcessId(windowHandle, out trash);
}