microsoft / CsWin32

A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.
MIT License
1.99k stars 84 forks source link

Many Win32 structs (HDC, HMONITOR, etc.) lack the IntPtr conversion operator. #1217

Open L00pZBreak3r opened 1 week ago

L00pZBreak3r commented 1 week ago

Actual behavior

Many Win32 structs (HDC, HMONITOR, etc.) lack the IntPtr conversion operator. For example, HWND has such an operator, but HDC does not. So, it's not even possible to check if HDC equals to zero.

Expected behavior

Maybe it's not a bug, however it's not clear why these stucts lack such an operator. Why does HWND have it and HDC does not?

Context