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);
}
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: