gabdube / native-windows-gui

A light windows GUI toolkit for rust
https://gabdube.github.io/native-windows-gui/
MIT License
1.93k stars 125 forks source link

Avoid GDI DC exhaustion from calling DPI #301

Open eugenesvk opened 1 month ago

eugenesvk commented 1 month ago

I'd like to show a tooltip-like window near a mouse pointer, for I poll for its position and on each call check dpi (in case the mouse moves to a different monitor) to update the size of the tooltip accordingly if dpi changes

However, I've noticed that this generates a lot of GDI DC handles

Is it simply missing an extra releasedc call after calculating DPI? https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-releasedc