External/Aga.Controls/Tree/NativeMethods.cs
author StephaneLenclud
Thu, 18 Apr 2013 23:25:10 +0200
branchMiniDisplay
changeset 444 9b09e2ee0968
permissions -rw-r--r--
Front View plug-in does not init if no sensor added.
Fixing some format to make strings shorter.
Now trying to start SoundGraphAccess.exe process from same directory.
Packed mode now can display three sensors along with the current time.
     1 using System;
     2 using System.Drawing;
     3 using System.Runtime.InteropServices;
     4 
     5 
     6 namespace Aga.Controls.Tree
     7 {
     8     internal static class NativeMethods
     9     {
    10         public const int DCX_WINDOW = 0x01;
    11         public const int DCX_CACHE = 0x02;
    12         public const int DCX_NORESETATTRS = 0x04;
    13         public const int DCX_CLIPCHILDREN = 0x08;
    14         public const int DCX_CLIPSIBLINGS = 0x10;
    15         public const int DCX_PARENTCLIP = 0x20;
    16         public const int DCX_EXCLUDERGN = 0x40;
    17         public const int DCX_INTERSECTRGN = 0x80;
    18         public const int DCX_EXCLUDEUPDATE = 0x100;
    19         public const int DCX_INTERSECTUPDATE = 0x200;
    20         public const int DCX_LOCKWINDOWUPDATE = 0x400;
    21         public const int DCX_VALIDATE = 0x200000;
    22 
    23         public const int WM_THEMECHANGED = 0x031A;
    24         public const int WM_NCPAINT = 0x85;
    25         public const int WM_NCCALCSIZE = 0x83;
    26 
    27         public const int WS_BORDER = 0x800000;
    28         public const int WS_EX_CLIENTEDGE = 0x200;
    29 
    30         public const int WVR_HREDRAW = 0x100;
    31         public const int WVR_VREDRAW = 0x200;
    32         public const int WVR_REDRAW = (WVR_HREDRAW | WVR_VREDRAW);
    33 
    34         [StructLayout(LayoutKind.Sequential)]
    35         public struct NCCALCSIZE_PARAMS
    36         {
    37             public RECT rgrc0, rgrc1, rgrc2;
    38             public IntPtr lppos;
    39         }
    40 
    41         [StructLayout(LayoutKind.Sequential)]
    42         public struct RECT
    43         {
    44             public int Left;
    45             public int Top;
    46             public int Right;
    47             public int Bottom;
    48 
    49             public static RECT FromRectangle(Rectangle rectangle)
    50             {
    51                 RECT result = new RECT();
    52                 result.Left = rectangle.Left;
    53                 result.Top = rectangle.Top;
    54                 result.Right = rectangle.Right;
    55                 result.Bottom = rectangle.Bottom;
    56                 return result;
    57             }
    58 
    59             public Rectangle ToRectangle()
    60             {
    61                 return new Rectangle(Left, Top, Right - Left, Bottom - Top);
    62             }
    63         }
    64 
    65         [DllImport("user32.dll", SetLastError = true)]
    66         public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
    67 
    68         [DllImport("user32.dll")]
    69         public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
    70 
    71         [DllImport("user32.dll")]
    72         public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
    73     }
    74 }