Beispiel #1
0
bool WdeSaveResourceToFile( WdeResInfo *res_info )
{
    bool        ok;
    char        fn[_MAX_PATH];

    WdeSetWaitCursor( TRUE );

    ok = (res_info != NULL && res_info->info != NULL);

    if( ok ) {
        if( res_info->info->save_type == WR_WIN_RC_DLG ||
            res_info->info->save_type == WR_WIN_RC ) {
            if( res_info->info->internal_type == WR_DONT_KNOW ) {
                WRGetInternalRESName( res_info->info->save_name, fn );
                res_info->info->internal_type = WdeSelectFileType( fn, res_info->is32bit );
            }
        }
    }

    if( ok ) {
        ok = WdeInfoToData( res_info );
    }

    if( ok ) {
        if( res_info->info->save_type == WR_WIN_RC_DLG ||
            res_info->info->save_type == WR_WIN_RC ) {
            ok = WdeSaveRC( res_info->info->save_name, res_info );
        }
    }

    // if we are saving a .RES file then auto create a dlg script
    if( ok ) {
        if( res_info->info->save_type == WR_WIN16M_RES ||
            res_info->info->save_type == WR_WIN16W_RES ||
            res_info->info->save_type == WR_WINNTM_RES ||
            res_info->info->save_type == WR_WINNTW_RES ) {
            char        dlgName[_MAX_PATH];
            if( WdeCreateDLGName( res_info->info->save_name, dlgName ) ) {
                ok = WdeSaveRC( dlgName, res_info );
            }
        }
    }

    if( ok ) {
        ok = WRSaveResource( res_info->info, true );
    }

    if( ok ) {
        WdeSetResModified( res_info, FALSE );
    }

    if( res_info != NULL && res_info->info->save_type != WR_WIN_RC_DLG ) {
        WdeFreeInfoData( res_info );
    }

    WdeSetWaitCursor( FALSE );

    return( ok );
}
Beispiel #2
0
int WRSaveResourceToEXE ( WRInfo *info, int backup, WRFileType ttype )
{
    int        ok;
    char       *tmp_res;
    char       *sname;
    WRFileType  stype;

    sname = NULL;

    ok = ( info->file_name != NULL );

    ok = ( ok && ( ( tmp_res = WRGetTempFileName ( "res" ) ) != NULL ) );

    if ( ok ) {
        sname = info->save_name;
        stype = info->save_type;
        info->save_name = tmp_res;
        info->save_type = ttype;
        ok = WRSaveResource ( info, FALSE );
    }

    if ( ok ) {
        if ( backup && WRFileExists ( sname ) ) {
            ok = WRBackupFile ( sname, FALSE );
        }
    }

    if ( ok ) {
        memset ( &CmdLineParms, 0, sizeof ( CmdLineParms ) );
        CmdLineParms.Pass2Only    = TRUE;
        CmdLineParms.VersionStamp = VERSION_31_STAMP;
        if ( ttype == WR_WINNTW_RES ) {
            CmdLineParms.TargetOS = RC_TARGET_OS_WIN32;
        } else {
            CmdLineParms.TargetOS = RC_TARGET_OS_WIN16;
        }
        strcpy ( CmdLineParms.InFileName, tmp_res );
        strcpy ( CmdLineParms.InExeFileName, info->file_name );
        if ( stricmp ( sname, info->file_name ) ) {
            strcpy ( CmdLineParms.OutExeFileName, sname );
        } else {
            strcpy ( CmdLineParms.OutExeFileName, info->file_name );
        }
        ok = WRExecRCPass2 ();
    }

    if ( tmp_res ) {
        WRDeleteFile ( tmp_res );
        WRMemFree ( tmp_res );
    }

    if ( sname ) {
        info->save_name = sname;
        info->save_type = stype;
    }

    return ( ok );
}
Beispiel #3
0
Bool WRESaveResourceToFile( WREResInfo *res_info )
{
    Bool          ok;

    WRESetWaitCursor( TRUE );

    ok = (res_info != NULL && res_info->info != NULL);

    if( ok ) {
        ok = WRSaveResource( res_info->info, TRUE );
    }

    if( ok ) {
        WRESetResModified( res_info, FALSE );
    }

    WRESetWaitCursor( FALSE );

    return( ok );
}
Beispiel #4
0
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 );
}