Are you sure you have the correct handle value? Assuming your thread is on the same desktop as the other window it is guaranteed to work correctly. If it returns false then the HWND
is not valid because A) your HWND
variable contains a numerical value that is not a valid HWND
, or B) timing issues where the window is destroyed while you are calling the function.
solved WINAPI IsWindow return false [closed]