Exemplo n.º 1
0
        public MessageWindow(Standard.CS classStyle, Standard.WS style, Standard.WS_EX exStyle, Rect location, string name, Standard.WndProc callback)
        {
            this._wndProcCallback = callback;
            this._className       = "MessageWindowClass+" + Guid.NewGuid().ToString();
            Standard.WNDCLASSEX lpwcx = new Standard.WNDCLASSEX {
                cbSize        = Marshal.SizeOf(typeof(Standard.WNDCLASSEX)),
                style         = classStyle,
                lpfnWndProc   = s_WndProc,
                hInstance     = Standard.NativeMethods.GetModuleHandle(null),
                hbrBackground = Standard.NativeMethods.GetStockObject(Standard.StockObject.NULL_BRUSH),
                lpszMenuName  = "",
                lpszClassName = this._className
            };
            Standard.NativeMethods.RegisterClassEx(ref lpwcx);
            GCHandle handle = new GCHandle();

            try
            {
                handle = GCHandle.Alloc(this);
                IntPtr lpParam = (IntPtr)handle;
                this.Handle = Standard.NativeMethods.CreateWindowEx(exStyle, this._className, name, style, (int)location.X, (int)location.Y, (int)location.Width, (int)location.Height, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, lpParam);
            }
            finally
            {
                handle.Free();
            }
        }
Exemplo n.º 2
0
        public static IntPtr CreateWindowEx(Standard.WS_EX dwExStyle, string lpClassName, string lpWindowName, Standard.WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam)
        {
            IntPtr ptr = _CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);

            if (IntPtr.Zero == ptr)
            {
                Standard.HRESULT.ThrowLastError();
            }
            return(ptr);
        }
Exemplo n.º 3
0
 private static extern IntPtr _CreateWindowEx(Standard.WS_EX dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName, [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, Standard.WS dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam);
Exemplo n.º 4
0
 public static Standard.RECT AdjustWindowRectEx(Standard.RECT lpRect, Standard.WS dwStyle, bool bMenu, Standard.WS_EX dwExStyle)
 {
     if (!_AdjustWindowRectEx(ref lpRect, dwStyle, bMenu, dwExStyle))
     {
         Standard.HRESULT.ThrowLastError();
     }
     return(lpRect);
 }
Exemplo n.º 5
0
 private static extern bool _AdjustWindowRectEx(ref Standard.RECT lpRect, Standard.WS dwStyle, [MarshalAs(UnmanagedType.Bool)] bool bMenu, Standard.WS_EX dwExStyle);