2 * USER initialization code
8 #include "wine/winbase16.h"
22 #include "sysmetrics.h"
27 /***********************************************************************
28 * USER initialisation routine
30 BOOL WINAPI USER_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
35 if ( USER_HeapSel ) return TRUE;
37 /* Create USER heap */
38 pModule = NE_GetPtr( GetModuleHandle16( "USER" ) );
41 USER_HeapSel = GlobalHandleToSel16( (NE_SEG_TABLE( pModule ) +
42 pModule->dgroup - 1)->hSeg );
46 USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 0x10000 );
47 LocalInit16( USER_HeapSel, 0, 0xffff );
50 /* Global atom table initialisation */
51 if (!ATOM_Init( USER_HeapSel )) return FALSE;
53 /* Initialize window handling (critical section) */
56 /* Initialize system colors and metrics*/
63 /* Initialize window procedures */
64 if (!WINPROC_Init()) return FALSE;
66 /* Initialize built-in window classes */
67 if (!WIDGETS_Init()) return FALSE;
69 /* Initialize dialog manager */
70 if (!DIALOG_Init()) return FALSE;
72 /* Initialize menus */
73 if (!MENU_Init()) return FALSE;
75 /* Initialize message spying */
76 if (!SPY_Init()) return FALSE;
78 /* Create system message queue */
79 queueSize = GetProfileIntA( "windows", "TypeAhead", 120 );
80 if (!QUEUE_CreateSysMsgQueue( queueSize )) return FALSE;
82 /* Set double click time */
83 SetDoubleClickTime( GetProfileIntA("windows","DoubleClickSpeed",452) );
85 /* Create message queue of initial thread */
86 InitThreadInput16( 0, 0 );
88 /* Create desktop window */
89 if (!WIN_CreateDesktopWindow()) return FALSE;
91 /* Initialize keyboard driver */
92 KEYBOARD_Enable( keybd_event, InputKeyStateTable );
94 /* Initialize mouse driver */
95 MOUSE_Enable( mouse_event );
97 /* Start processing X events */
98 UserRepaintDisable16( FALSE );