Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do HMONITORs need to be released? If so, how?

Several multiple-monitor API functions (eg, MonitorFromRect) return a HMONITOR handle to the monitor in question. I have been unable to find the function to free this handle - does it need to be freed, and if so, how should I free it?

like image 263
bdonlan Avatar asked Feb 25 '23 07:02

bdonlan


2 Answers

The SDK docs always explicitly mention how a handle needs to be released. Nothing for HMONITOR, you are just getting a handle to an internal object that's around anyway.

like image 64
Hans Passant Avatar answered Feb 27 '23 20:02

Hans Passant


Microsoft's Example program doesn't try to free the handle. While their examples might not be perfect, they are a good indication of the way a function is meant to be used.

like image 32
Mark Ransom Avatar answered Feb 27 '23 21:02

Mark Ransom