Example #1
0
        void registerClass( )
        {
            USER32.WNDCLASSEX wndClassEx = new USER32.WNDCLASSEX( );
            wndClassEx.cbClsExtra    = 0;
            wndClassEx.cbWndExtra    = 0;
            wndClassEx.cbSize        = ( uint )Marshal.SizeOf(wndClassEx);
            wndClassEx.style         = (USER32.CS_VREDRAW | USER32.CS_HREDRAW);
            wndClassEx.hbrBackground = ( IntPtr )5;
            wndClassEx.hInstance     = this.hInstance;
            wndClassEx.hCursor       = USER32.LoadCursor(IntPtr.Zero, USER32.IDC_ARROW);
            wndClassEx.hIcon         = USER32.LoadIcon(IntPtr.Zero, USER32.IDI_APPLICATION);
            wndClassEx.hIconSm       = wndClassEx.hIcon;
            wndClassEx.lpszMenuName  = null;
            wndClassEx.lpszClassName = WND_CLASSNAME;
            wndClassEx.lpfnWndProc   = this.windowEvents;

            if (USER32.RegisterClassEx(ref wndClassEx) == 0)
            {
                throw new InvalidOperationException("[USER32.RegisterClassEx] Can't register window class " + WND_CLASSNAME + ".");
            }
        }