Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
L00pZBreak3r opened this issue Jun 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@L00pZBreak3r
Copy link

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

  • CsWin32 version: 0.3.106, built from the latest source code.
  • Win32Metadata: 61.0.15-preview.
  • Target Framework: netstandard2.0.
  • LangVersion: latest.
@L00pZBreak3r L00pZBreak3r added the bug Something isn't working label Jun 23, 2024
@AArnott
Copy link
Member

AArnott commented Sep 27, 2024

It works for me with 0.3.106

IntPtr p = (HMONITOR)default;
HMONITOR m = (HMONITOR)p;

p = (HWND)default;
HWND h = (HWND)p;

@AArnott AArnott closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants