J
Jon Shemitz
I'm writing a docking window control, and need to write on the
desktop, so I can show a candidate dock rectangle on top of the dock
manager's child controls.
I found
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
and
[DllImport("user32.dll")]
private static extern IntPtr GetShellWindow();
but when I do
IntPtr Handle = DesktopWindow();
Graphics Desktop = Graphics.FromHdc(Handle);
Desktop.ReleaseHdc(Handle);
private IntPtr DesktopWindow()
{
IntPtr Result = GetShellWindow();
if (Result != IntPtr.Zero)
return Result;
return GetDesktopWindow();
}
in an OnPaint or OnMouseMove handler, I get an "Out of memory"
exception - even when I don't draw anything!
Google shows me that others have this problem - but doesn't show me a
solution ....
desktop, so I can show a candidate dock rectangle on top of the dock
manager's child controls.
I found
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
and
[DllImport("user32.dll")]
private static extern IntPtr GetShellWindow();
but when I do
IntPtr Handle = DesktopWindow();
Graphics Desktop = Graphics.FromHdc(Handle);
Desktop.ReleaseHdc(Handle);
private IntPtr DesktopWindow()
{
IntPtr Result = GetShellWindow();
if (Result != IntPtr.Zero)
return Result;
return GetDesktopWindow();
}
in an OnPaint or OnMouseMove handler, I get an "Out of memory"
exception - even when I don't draw anything!
Google shows me that others have this problem - but doesn't show me a
solution ....