void WRESEAPI WMenuInit( void ) { HINSTANCE inst; inst = WGetEditInstance(); if( AccelTable == (HACCEL)NULL ) { AccelTable = LoadAccelerators( inst, "WMenuAccelTable"); } if( InsertBefore == (HBITMAP)NULL ) { InsertBefore = LoadBitmap( inst, "InsertBefore"); } if( InsertAfter == (HBITMAP)NULL ) { InsertAfter = LoadBitmap( inst, "InsertAfter"); } if( InsertSub == (HBITMAP)NULL ) { InsertSub = LoadBitmap( inst, "InsertSub"); } if( InsertNoSub == (HBITMAP)NULL ) { InsertNoSub = LoadBitmap( inst, "InsertNoSub"); } if( ref_count == 0 ) { WRInit(); WInitDisplayError( inst ); WInit( inst ); WInitDummyMenuEntry(); } ref_count++; }
/* * WinMain - main entry point */ int WINMAINENTRY WinMain( HINSTANCE currinst, HINSTANCE previnst, LPSTR cmdline, int cmdshow ) { MSG msg; cmdline = cmdline; #if defined( __NT__ ) && !defined( __WATCOMC__ ) _argc = __argc; _argv = __argv; #endif WRInit(); if( _argc > 1 ) { parseArgs( _argc, _argv ); } if( !imgEditInit( currinst, previnst, cmdshow ) ) { if( ImgedIsDDE ) { IEDDEDumpConversation( currinst ); } return( 0 ); } if( ImgedIsDDE ) { if( IEDDEStart( currinst ) ) { if( !IEDDEStartConversation() ) { WImgEditError( WIE_DDE_INIT_FAILED, NULL ); PostMessage( HMainWindow, WM_CLOSE, (WPARAM)1, 0 ); } } else { WImgEditError( WIE_DDE_INIT_FAILED, NULL ); PostMessage( HMainWindow, WM_CLOSE, (WPARAM)1, 0 ); } } IEEnableMenuInput( TRUE ); if( _argc > 1 ) { parseCmdLine( _argc, _argv ); } while( GetMessage( &msg, (HWND)NULL, 0, 0 ) ) { if( !TranslateMDISysAccel( ClientWindow, &msg ) && !TranslateAccelerator( HMainWindow, hAccel, &msg ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } } if( ImgedIsDDE ) { IEDDEEndConversation(); IEDDEEnd(); } imgEditFini(); WRFini(); return( 1 ); } /* WinMain */
void WRESEAPI WAccelInit( void ) { HINSTANCE inst; inst = WGetEditInstance(); if( AccelTable == (HACCEL)NULL ) { AccelTable = LoadAccelerators( inst, "WAccelAccelTable"); } if( ref_count == 0 ) { WRInit(); SetInstance( inst ); WInit( inst ); } ref_count++; }
void WINEXPORT WAccelInit( void ) { HINSTANCE inst; inst = WGetEditInstance(); if( AccelTable == (HACCEL)NULL ) { AccelTable = LoadAccelerators( inst, "WAccelAccelTable"); } if( ref_count == 0 ) { WRInit(); WInitDisplayError( inst ); WInit( inst ); } ref_count++; }
int PASCAL WinMain( HINSTANCE hinstCurrent, HINSTANCE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow ) { MSG msg; #ifndef __NT__ #if 0 HWND win; HWND child; #endif #endif /* touch unused vars to get rid of warning */ _wde_touch( lpszCmdLine ); _wde_touch( nCmdShow ); #ifdef __NT__ _wde_touch( hinstPrevious ); #endif #if defined( __NT__ ) && !defined( __WATCOMC__ ) _argc = __argc; _argv = __argv; #endif WRInit(); WdeInitDisplayError( hinstCurrent ); /* store the handle to this instance of Wde in a static variable */ hInstWde = hinstCurrent; //check we are running in DDE mode IsDDE = WdeIsDDEArgs( _argv, _argc ); WdeFirstInst = (hinstPrevious == NULL); WdeInitEditClass(); /* is this the first instance of the application? */ #ifndef __NT__ if( WdeFirstInst ) { #endif /* if so call the routine to initialize the application */ if( !WdeInit( hinstCurrent ) ) { if( IsDDE ) { WdeDDEDumpConversation( hinstCurrent ); } return( FALSE ); } #ifndef __NT__ } #if 0 else if( IsDDE ) { WdeDisplayErrorMsg( WDE_NOMULTIPLEINSTANCES ); WdeDDEDumpConversation( hinstCurrent ); return( FALSE ); } else { win = FindWindow( WdeMainClass, NULL ); if( win != NULL ) { child = GetLastActivePopup( win ); PostMessage( win, WM_USER, 0, 0 ); BringWindowToTop( win ); if( child != (HWND)NULL && child != win ) { BringWindowToTop( child ); } } else { WdeDisplayErrorMsg( WDE_NOMULTIPLEINSTANCES ); } return( FALSE ); } #endif #endif if( !WdeInitInst( hinstCurrent ) ) { WdeDisplayErrorMsg( WDE_INITFAILED ); if( IsDDE ) { WdeDDEDumpConversation( hinstCurrent ); } return( FALSE ); } if( IsDDE ) { if( WdeDDEStart( hinstCurrent ) ) { if( !WdeDDEStartConversation() ) { WdeDisplayErrorMsg( WDE_DDEINITFAILED ); PostMessage( hWinWdeMain, WDE_FATAL_EXIT, 0, 0 ); } } else { WdeDisplayErrorMsg( WDE_DDEINITFAILED ); PostMessage( hWinWdeMain, WDE_FATAL_EXIT, 0, 0 ); } } WdeEnableMenuInput( TRUE ); if( setjmp( WdeEnv ) ) { PostMessage( hWinWdeMain, WDE_FATAL_EXIT, 0, 0 ); if( setjmp( WdeEnv ) ) { WdeDisplayErrorMsg( WDE_EXCEPTIONDURINGABNORMALEXIT ); exit( -1 ); } WdePushEnv( &WdeEnv ); } else { WdePushEnv( &WdeEnv ); WdeProcessArgs( _argv, _argc ); } if( !WdeGetNumRes() ) { WdeCreateNewResource( NULL ); } /* create the message loop */ while( GetMessage( &msg, (HWND)NULL, 0, 0 ) ) { if( !WdeIsTestMessage( &msg ) && !WdeIsInfoMessage( &msg ) && !WRIsWRDialogMsg( &msg ) ) { if( !WdeWasAcceleratorHandled( &msg ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } } } if( IsDDE ) { WdeDDEEndConversation(); } WdePopEnv( &WdeEnv ); if( IsDDE ) { WdeDDEEnd(); } WRFini(); return( msg.wParam ); }
int PASCAL WinMain( HINSTANCE hinstCurrent, HINSTANCE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow ) { extern char **_argv; extern int _argc; MSG msg; Bool ret; /* touch unused vars to get rid of warning */ _wre_touch( lpszCmdLine ); _wre_touch( nCmdShow ); #ifdef __NT__ _wre_touch( hinstPrevious ); #endif WRInit(); WAccelInit(); WMenuInit(); WStringInit(); WREInitDisplayError( hinstCurrent ); /* store the handle to this instance of WRE in a static variable */ WREInst = hinstCurrent; peekArgs( _argv, _argc ); /* is this the first instance of the application? */ #ifndef __NT__ if( hinstPrevious == NULL ) { #endif /* if so call the routine to initialize the application */ if( !WREInit( hinstCurrent ) ) { return( FALSE ); } #ifndef __NT__ } #endif if( !WREInitInst( hinstCurrent ) ) { WREDisplayErrorMsg( WRE_INITFAILED ); return( FALSE ); } if( !WREDDEStart( hinstCurrent ) ) { WREDisplayErrorMsg( WRE_DDEINITFAILED ); return( FALSE ); } ret = WREProcessArgs( _argv, _argc ); startEditors(); // create a new empty res if none have been created at this point if( ret && WREGetNumRes() == 0 ) { WRECreateNewResource( NULL ); } /* create the message loop */ while( GetMessage( &msg, (HWND)NULL, 0, 0 ) ) { if( !WREIsEditWindowDialogMessage( &msg ) && !WREWasAcceleratorHandled( &msg ) && !WREIsResInfoWinMsg( &msg ) && !WRIsWRDialogMsg( &msg ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } } WREDDEEnd(); WStringFini(); WMenuFini(); WAccelFini(); WRFini(); return( msg.wParam ); }
int PASCAL WinMain( HINSTANCE hinstCurrent, HINSTANCE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow ) { int ret; int i; int ltype; int stype; bool backup; WRInfo *info; WRFileType ftype; uint_16 mflags; WRSelectImageInfo *sii; #if 0 bool dup; char *data; WResID type; WResID name; #endif hinstCurrent = hinstCurrent; hinstPrevious = hinstPrevious; lpszCmdLine = lpszCmdLine; nCmdShow = nCmdShow; info = NULL; ret = TRUE; WRInit(); if( _argc == 6 ) { ltype = atoi( _argv[2] ); stype = atoi( _argv[4] ); backup = (atoi( _argv[5] ) != 0); if( stype != 0 ) { info = WRLoadResource( _argv[1], ltype ); if( info != NULL ) { info->save_name = _argv[3]; info->save_type = stype; ret = WRSaveResource( info, backup ); } else { ret = FALSE; } } #if 0 } else if( _argc == 2 ) { ret = FALSE; data = WRMemAlloc( 32 ); if( data != NULL ) { for( i = 0; i < 32; i++ ) { data[i] = i; } type.IsName = name.IsName = FALSE; type.ID.Num = 10; name.ID.Num = 200; ret = WRSaveObjectAs( _argv[1], WR_WIN16M_RES, &type, &name, data, 32, 0 ); WRMemFree( data ); } } else if( _argc == 3 ) { ret = FALSE; data = WRMemAlloc( 32 ); if( data != NULL ) { for( i = 0; i < 32; i++ ) { data[i] = i; } type.IsName = name.IsName = FALSE; type.ID.Num = 10; name.ID.Num = 100; ret = WRSaveObjectInto( _argv[1], &type, &name, data, 32, 0, &dup ); WRMemFree( data ); } #endif } else { for( i = 1; i < _argc; i++ ) { WRSelectFileType( HWND_DESKTOP, _argv[i], FALSE, i % 2, NULL ); ftype = WRIdentifyFile( _argv[i] ); } ret = TRUE; } WRChangeMemFlags( HWND_DESKTOP, "test", &mflags, NULL ); if( info != NULL ) { info->save_name = NULL; WRFreeWRInfo( info ); } info = WRLoadResource( _argv[1], WR_DONT_KNOW ); sii = WRSelectImage( HWND_DESKTOP, info, NULL ); if( sii != NULL ) { WRFreeSelectImageInfo( sii ); } WRFreeWRInfo( info ); if( !ret ) { MessageBox( (HWND)NULL, "Error occurred!", "TEST WR", MB_ICONEXCLAMATION | MB_OK | MB_APPLMODAL ); } WRFini(); return( ret ); }