         [ DispatchMessage drop ] bi
     ] if ;
 
-: register-wndclassex ( -- class )
-    "WNDCLASSEX" <c-object>
-    f GetModuleHandle
-    class-name-ptr get-global
-    pick GetClassInfoEx zero? [
+:: register-window-class ( class-name-ptr -- )
+    "WNDCLASSEX" <c-object> f GetModuleHandle
+    class-name-ptr pick GetClassInfoEx 0 = [
         "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 ;

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

        over set-WNDCLASSEX-hIcon
        f IDC_ARROW LoadCursor over set-WNDCLASSEX-hCursor

        class-name-ptr over set-WNDCLASSEX-lpszClassName
        RegisterClassEx win32-error=0/f
    ] [ drop ] if ;

: adjust-RECT ( RECT -- )
    style 0 ex-style AdjustWindowRectEx win32-error=0/f ;
