#2 P/Invoke to user32.dll/GetDC() and related functions

closed-fixed
nobody
None
5
2012-10-20
2009-09-29
Jason Oster
No

The IDE splash form uses user32.dll functions to make the background transparent. Mono does not handle these calls, and throws an exception.

The following patch is a work-around which gives up making the splash form pretty if an exception occurs:

Index: branches/SGDK2IDE2.1/SplashForm.cs

--- branches/SGDK2IDE2.1/SplashForm.cs (revision 157)
+++ branches/SGDK2IDE2.1/SplashForm.cs (working copy)
@@ -104,6 +104,8 @@

protected override void OnLoad(EventArgs e)
{
+ try
+ {
BLENDFUNCTION bf;

String strAppDir = Application.ExecutablePath;
@@ -132,6 +134,11 @@
m_SplashImage = null;
ReleaseDC(IntPtr.Zero, hdcScreen);
}
+ catch
+ {
+ Console.WriteLine("GetDC() failed.");
+ }
+ }

protected override CreateParams CreateParams
{

Discussion

  • Benjamin Marty
    Benjamin Marty
    2012-10-20

    • status: open --> closed-accepted
     
  • Benjamin Marty
    Benjamin Marty
    2012-10-20

    Am not able to test in MonoDevelop at the moment because the project uses .NET 4.5 and at least on my environment, MonoDevelop thinks I don't have .NET 4.5 installed.

     
  • Benjamin Marty
    Benjamin Marty
    2012-10-20

    • status: closed-accepted --> closed-fixed