コード例 #1
0
CLocationsPrefPage::CLocationsPrefPage() : CPPPropertyPage(CLocationsPrefPage::IDD)
{
	GetExtNamePath( m_Clipbits, IDN_CLIPBOARD );
	GetExtNamePath( m_Printstyles, IDN_STYLE );
	GetExtNamePath( m_Brushes, IDN_CUSTOM );
	GetExtNamePath( m_Palettes,IDN_PALETTE );
	GetExtNamePath( m_Textures, IDN_TEXTURE );
	GetExtNamePath( m_Devices, IDN_SCANNER );
	GetExtNamePath( m_Effects, IDN_SPECIAL );
    GetExtNamePath( m_Macros, IDN_MACRO );
    GetExtNamePath( m_Importfilters, IDN_IMPORTFILTERS );
}
コード例 #2
0
BOOL PasteFromClipboard( HWND hWindow, BOOL fNeedMask )
/************************************************************************/
{
// The MGX format will stuff the path strings since the files already exist
if ( IsClipboardFormatAvailable( Control.cfImage ) )
	return( PasteMGXImage( hWindow, Names.PasteImageFile, Names.PasteMaskFile));

// Other formats need to create the file, therefore we stuff the path
// strings first
GetExtNamePath( Names.PasteImageFile, IDN_CLIPBOARD );
lstrcat( Names.PasteImageFile, "WINCLIP.BMP" );
Names.PasteMaskFile[0] = '\0';

if ( IsClipboardFormatAvailable( CF_DIB ) )
	return( PasteDIB( hWindow, Names.PasteImageFile, NULL ) );
else
if ( IsClipboardFormatAvailable( CF_BITMAP ) )
	return( PasteBitmap( hWindow, Names.PasteImageFile, NULL ) );
return( FALSE );
}
コード例 #3
0
int AstralImageImport( LPSTR lpInFile, LPSTR lpProfile, int nFileType )
//////////////////////////////////////////////////////////////////////////
{
    OFSTRUCT ofstruct;

    HINSTANCE hDLL              = NULL;
    HINSTANCE hSrcLibrary       = NULL;
    HINSTANCE hDstLibrary       = NULL;
    HINSTANCE hImportSetupData  = NULL;
    HINSTANCE hExportSetupData  = NULL;

    CREATESETUP  lpfnCreateSetup    = NULL;
    DESTROYSETUP lpfnDestroySetup   = NULL;
    IMPORTPROC   lpfnImportProc     = NULL;

    IMPORT_OPTIONS   Options;
    EXPORT_OPTIONS   Export;

    int error = IMPORT_NOERROR;

    FNAME szFilterPath;
    FNAME szOutFile; 
    FNAME szTempFile;
    FNAME szINIPath;
    char szFilter[13]; 
    char szINI[13]; 

    ProgressBegin( 1, PROGRESS_ID( IDS_UNDOIMPORTIMAGE ));

    szFilterPath[0] = szOutFile[0] = szTempFile[0] = szINIPath[0] = 0;
    szFilter[0] = szINI[0] = 0; 

    if( !nFileType || 
         nFileType < IDN_FIRSTIMPORTFILETYPE || 
         nFileType > IDN_LASTIMPORTFILETYPE )
    {
        error = IMPORT_INVALIDFILE_ERROR;
        goto ImportAbort;
    }

    // load ISGDI9.DLL explicitly
    GetModuleFileName( PictPubApp.Get_hInstAstral(), szFilterPath, sizeof( szFilterPath ));
    *strrchr( szFilterPath, '\\' ) = '\0';        
    lstrcat( szFilterPath, "\\" );
    lstrcat( szFilterPath, FILTER_DRIVER );

    hDLL = LoadLibrary( szFilterPath );

#ifdef WIN32
    if( hDLL == NULL )
#else
    if( hDLL < HINSTANCE_ERROR )
#endif
    {
        error = IMPORT_DLLLOAD_ERROR;
        goto ImportAbort;
    }

    // get filter and profile names
    GetImportFilter( nFileType, szFilter, szINI );

    // get location of filters
    GetExtNamePath( szFilterPath, IDN_IMPORTFILTERS );

    // set import filter path
    lstrcat( szFilterPath, szFilter );  

    if( OpenFile( szFilterPath, &ofstruct, OF_EXIST ) == HFILE_ERROR ) 
    {
        error = IMPORT_SRCLIBLOAD_ERROR;
        goto ImportAbort;
    }

    // set import filter profile path
    if( Control.bNetworkInstall )       // use pouch path
    {
        GetIniPath( szINIPath );
    }
    else                               // use filters directory
    {
        GetExtNamePath( szINIPath, IDN_IMPORTFILTERS );
    }
    lstrcat( szINIPath, szINI );  

#ifdef WIN32
    if(( hSrcLibrary = LoadLibrary( szFilterPath )) != NULL )
#else
    if(( hSrcLibrary = LoadLibrary( szFilterPath )) >= HINSTANCE_ERROR )
#endif
    {
        lpfnCreateSetup     = 
                ( CREATESETUP )GetProcAddress( hSrcLibrary, "CreateSetup" );
        hImportSetupData    = 
                ( HINSTANCE )( *lpfnCreateSetup )( hSrcLibrary, szINIPath, NULL, NULL );
    }
    else
    {
        error = IMPORT_SRCLIBLOAD_ERROR;
        goto ImportAbort;
    }

    // set export filter path 
    *strrchr( szFilterPath, '\\' ) = '\0';        
    lstrcat( szFilterPath, "\\" );
    lstrcat( szFilterPath, EXPORT_FILTER );

    if( OpenFile( szFilterPath, &ofstruct, OF_EXIST ) == HFILE_ERROR ) 
    {
        error = IMPORT_DSTLIBLOAD_ERROR;
        goto ImportAbort;
    }

#ifdef WIN32
    if(( hDstLibrary = LoadLibrary( szFilterPath )) != NULL )
#else
    if(( hDstLibrary = LoadLibrary( szFilterPath )) >= HINSTANCE_ERROR )
#endif
    {
        lpfnCreateSetup     = 
                ( CREATESETUP )GetProcAddress( hDstLibrary, "CreateSetup" );
        hExportSetupData    = 
                ( HINSTANCE )( *lpfnCreateSetup )( hDstLibrary, lpProfile, NULL, NULL );
    }
	else
    {
        error = IMPORT_DSTLIBLOAD_ERROR;
        goto ImportAbort;
    }

    memset( &Export, 0, sizeof( EXPORT_OPTIONS ));

    Export.GetSet_Status   = 
        ( GETSET_STATUS )MakeProcInstance(( FARPROC )GetSet_DialogStatus, PictPubApp.Get_hInstAstral());

    if( Export.GetSet_Status == NULL )
    {
        error = IMPORT_IMPORTFILE_ERROR;
        goto ImportAbort;
    }

    *strrchr( szFilterPath, '\\' ) = '\0';        
    *strrchr( szINIPath, '\\' ) = '\0';        

    memset( &Options, 0, sizeof( IMPORT_OPTIONS ));

    Options.hInputData     = hImportSetupData;      // Handle to import data
    Options.hOutputData    = hExportSetupData;      // Handle to export data
    Options.lpszDriverPath = szFilterPath;          // Driver DLL directory
    Options.lpszFontPath   = szFilterPath;          // Font file directory
    Options.lpExport       = &Export;

    // set temp file directory
    if( Control.bNetworkInstall )
        Options.lpszWorkPath   = szINIPath;         
    else
        Options.lpszWorkPath   = szFilterPath;         

    lstrcpy( szOutFile, Options.lpszWorkPath );     
    lstrcat( szOutFile, "\\" ); 

    // create temp file name
    lstrcpy( szTempFile, "PP" );
    GetTempFilename( szTempFile, ".TIF" );
    lstrcat( szOutFile, szTempFile );    

    lpfnImportProc = ( IMPORTPROC )GetProcAddress( hSrcLibrary, "ImportFile" );

    if( !( error = (( *lpfnImportProc )( NULL, EXPORT_FILTER, szOutFile, lpInFile, ( LPSTR )&Options ))))    
        lstrcpy( lpInFile, szOutFile );
    else
        FileDelete( szOutFile );        // get rid of temp file in case of error

    if( Export.GetSet_Status != NULL )
        FreeProcInstance(( FARPROC )Export.GetSet_Status );
    
ImportAbort:

#ifdef WIN32
    if( hDstLibrary != NULL )
#else
    if( hDstLibrary >= HINSTANCE_ERROR )
#endif
    {
        lpfnDestroySetup = ( DESTROYSETUP )GetProcAddress( hDstLibrary, "DestroySetup" );
        ( *lpfnDestroySetup )( hExportSetupData );

        FreeLibrary( hDstLibrary );
    }

#ifdef WIN32
    if( hSrcLibrary != NULL )
#else
    if( hSrcLibrary >= HINSTANCE_ERROR )
#endif
    {
        lpfnDestroySetup = ( DESTROYSETUP )GetProcAddress( hSrcLibrary, "DestroySetup" );
        ( *lpfnDestroySetup )( hImportSetupData );

        FreeLibrary( hSrcLibrary );
    }

#ifdef WIN32
    if( hDLL != NULL )
#else
    if( hDLL >= HINSTANCE_ERROR )
#endif
    {
        FreeLibrary( hDLL );
    }

    ProgressEnd();

    switch( error )
    {
        case IMPORT_NOERROR:
            break;

        case IMPORT_INVALIDFILE_ERROR:              // type not supported
            Message( IDS_INVALIDIMPORTFILE_ERROR );
            break;

        case IMPORT_SRCLIBLOAD_ERROR:               // error loading import filter
            Message( IDS_IMPORTLIBLOAD_ERROR );
            break;

        case IMPORT_DSTLIBLOAD_ERROR:               // error loading export filter
            Message( IDS_EXPORTLIBLOAD_ERROR );
            break;

        case IME_INVALID_FILE_TYPE:                 // incorrect file format
            Message( IDS_INVALIDIMPORTFILE_TYPE );
            break;

        case IME_INVALID_FILE_VERSION:              // unsupported file version
            Message( IDS_INVALIDIMPORTFILE_VERSION );
            break;

        case IME_MEMORY:                            // insufficient memory
            Message( IDS_EMEMALLOC );
            break;

        case IMPORT_DLLLOAD_ERROR:
        case IMPORT_IMPORTFILE_ERROR:               // non-specific error from app
        default:                                    // non-specific error from filter
            Message( IDS_IMPORTFILE_ERROR );    
            break;
    }
    return error;
}