 : init-win32-ui ( -- )
     V{ } clone nc-buttons set-global
     "MSG" malloc-object msg-obj set-global
-    "Factor-window" utf16n malloc-string class-name-ptr set-global
-    register-wndclassex drop
     GetDoubleClickTime milliseconds double-click-timeout set-global ;
 
 : cleanup-win32-ui ( -- )

        [ DispatchMessage drop ] bi
    ] if ;

: register-wndclassex ( -- class )
    "WNDCLASSEX" <c-object>
    f GetModuleHandle
    class-name-ptr get-global
    pick GetClassInfoEx zero? [
        "WNDCLASSEX" heap-size over set-WNDCLASSEX-cbSize
        { CS_HREDRAW CS_VREDRAW CS_OWNDC } flags over set-WNDCLASSEX-style
        ui-wndproc over set-WNDCLASSEX-lpfnWndProc

    dup adjust-RECT
    swap [ dup default-position-RECT ] when ;

: get-window-class ( -- class-name )
    class-name-ptr [
        dup expired? [ drop "Factor-window" utf16n malloc-string ] when
        dup register-window-class
        dup
    ] change-global ;

: create-window ( rect -- hwnd )
    make-adjusted-RECT
    [ get-window-class f ] dip
    [
        [ ex-style ] 2dip
        { WS_CLIPSIBLINGS WS_CLIPCHILDREN style } flags
