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 has been archived by the owner on Jul 26, 2023. It is now read-only.
When the method "PInvoke.Gdi32.CreateCompatibleDC" is called, a MissingMethodException is thrown with the message ".ctor"
public static User32.SafeDCHandle CreateCompatibleDC(User32.SafeDCHandle hDC);
I assume that the return value cannot be converted into a SafeDCHandle, because the window handle is not availble.
I would suggest to change the method signature to: public static IntPtr CreateCompatibleDC(User32.SafeDCHandle hDC);
The following work around is working:
var hdcSrc = GetWindowDC(windowHandle);
var hDest = MyGDI32.CreateCompatibleDC(hdcSrc.DangerousGetHandle());
var hdcDest = new SafeDCHandle(windowHandle, hDest);
class MyGDI32
{
[DllImport("gdi32.dll")]
public static extern IntPtr CreateCompatibleDC(IntPtr hDC);
}
The text was updated successfully, but these errors were encountered:
When the method "PInvoke.Gdi32.CreateCompatibleDC" is called, a MissingMethodException is thrown with the message ".ctor"
public static User32.SafeDCHandle CreateCompatibleDC(User32.SafeDCHandle hDC);
I assume that the return value cannot be converted into a SafeDCHandle, because the window handle is not availble.
I would suggest to change the method signature to:
public static IntPtr CreateCompatibleDC(User32.SafeDCHandle hDC);
The following work around is working:
The text was updated successfully, but these errors were encountered: