Only call TOOLBAR_CalcToolbar when parameters change.
[wine/wine64.git] / miscemu / main.c
blob43bb028fa69f58827cf40f5d4bbb0bb4929839de
1 /*
2 * Emulator initialisation code
4 */
6 #include "winbase.h"
7 #include "wine/winbase16.h"
8 #include "wingdi.h"
9 #include "winuser.h"
11 #include "miscemu.h"
12 #include "callback.h"
13 #include "options.h"
14 #include "dosexe.h"
15 #include "debugtools.h"
17 static char main_exe_name[MAX_PATH];
18 static HANDLE main_exe_file;
20 extern void PROCESS_InitWine( int argc, char *argv[], LPSTR win16_exe_name,
21 HANDLE *win16_exe_file ) WINE_NORETURN;
22 extern HINSTANCE16 NE_StartMain( LPCSTR name, HANDLE file );
24 /***********************************************************************
25 * Main loop of initial task
27 int WINAPI wine_initial_task( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, INT show )
29 MSG msg;
30 HINSTANCE16 instance;
32 if (!LoadLibraryA( "user32.dll" ))
34 MESSAGE( "Cannot load user32.dll\n" );
35 ExitProcess( GetLastError() );
37 THUNK_InitCallout();
39 if ((instance = NE_StartMain( main_exe_name, main_exe_file )) < 32)
41 if (instance == 11) /* try DOS format */
43 if (DPMI_LoadDosSystem())
44 Dosvm.LoadDosExe( main_exe_name, main_exe_file );
45 /* if we get back here it failed */
46 instance = GetLastError();
49 MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
50 switch (instance)
52 case 2: MESSAGE("file not found\n" ); break;
53 case 11: MESSAGE("invalid exe file\n" ); break;
54 default: MESSAGE("error=%d\n", instance ); break;
56 ExitProcess(instance);
58 CloseHandle( main_exe_file ); /* avoid file sharing problems */
60 /* Start message loop for desktop window */
62 while ( GetNumTasks16() > 1 && Callout.GetMessageA( &msg, 0, 0, 0 ) )
64 Callout.TranslateMessage( &msg );
65 Callout.DispatchMessageA( &msg );
68 ExitProcess( 0 );
72 /**********************************************************************
73 * main
75 int main( int argc, char *argv[] )
77 PROCESS_InitWine( argc, argv, main_exe_name, &main_exe_file );
78 return 1; /* not reached */