The application retrieve window handles, using Enum* routines.
It happens that in the while the application manage the handle (get class name, window statistics...) of an enumerated/created window, the handle is no more valid. The code managing window handles are protected using a try/catch block, but the window handle is stored and the successively used for managing the represented window.
How to handle the window handle lifetime? It is possible to detect the handle invalidity?
I d like to avoid try/catch blocks every time the application uses the window handles.