You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 26, 2023. It is now read-only.
[Question] Issue with IntPtr versus Safehandles in Gdi32.BitBlt #593
The issue is the function BitBlt wants IntPtr as input while the functions GetWindowDC and CreateCompatibleDC both return a SafeDCHandle.
Is there an overload for GetWindowDC and CreateCompatibleDC that return an IntPtr instead? Or can I make BitBlt to somehow accept the SafeDCHandles?
Before using this package I would use the code below. But this package sound really great. Safes a lot of time defining all the windows library functions you want to use.
[DllImport("gdi32.dll")]
public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
I suspect BitBlt should take SafeDCHandle as well. I'll send a PR to do this.
In the meantime you can always get the IntPtr from a SafeHandle using DangerousGetHandle(). Check the documentation on SafeHandle to learn how to use it safely for this.
Activity
Fix BitBlt to take `SafeDCHandle`
AArnott commentedon Jan 24, 2022
I suspect
BitBltshould takeSafeDCHandleas well. I'll send a PR to do this.In the meantime you can always get the IntPtr from a SafeHandle using
DangerousGetHandle(). Check the documentation onSafeHandleto learn how to use it safely for this.Fix BitBlt to take `SafeDCHandle`