Exemple #1
0
        public Win32Window()
        {
            var wndClass = WNDCLASSEX.Create();

            wndClass.cbClsExtra    = 0;
            wndClass.cbWndExtra    = 0;
            wndClass.hbrBackground = CreateSolidBrush(COLORREF.Create(PlayerSettings.backgroundColor));
            wndClass.hCursor       = LoadCursor(IntPtr.Zero, IDC_ARROW);
            wndClass.hIcon         = IntPtr.Zero;
            wndClass.hIconSm       = IntPtr.Zero;
            wndClass.hInstance     = IntPtr.Zero;
            wndClass.lpfnWndProc   = Marshal.GetFunctionPointerForDelegate(this.wndproc = this.ProcessWindowsMessage);
            wndClass.lpszClassName = className;
            wndClass.style         = WindowClassStyles.VREDRAW | WindowClassStyles.HREDRAW;
            if (0 == RegisterClassEx(ref wndClass))
            {
                throw new Exception();
            }
            CreateWindowEx(0, className, title, WindowStyles.OVERLAPPEDWINDOW, 100, 100, 1280, 720, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
            ShowWindow(this.handle, WindowShowStyle.Show);
            UpdateWindow(this.handle);
        }