////////////////////////////////////////////////////////////////////// // PUT THE FOLLOWING DECLARATIONS IN THE HEADER FILE ////////////////////////////////////////////////////////////////////// HINSTANCE FFLibDllHandle; bool ( __stdcall *pFFTwainOpen )( HWND ); int ( __stdcall *pFFTwainScan )( HWND, char*, int, int, int, char*, char*, int, int, int ); void ( __stdcall *pFFTwainClose )( void ); ////////////////////////////////////////////////////////////////////// // SECTION ONE --- PRELIMINARY OPERATIONS ////////////////////////////////////////////////////////////////////// // load the DLL FFLibDllHandle = 0; FFLibDllHandle = LoadLibrary ( "FFLIB.DLL" ); if ( FFLibDllHandle == 0 ) { MessageBox ( NULL, "LoadLibrary:\nFFLIB.DLL not found.", "Error FS 001", MB_SYSTEMMODAL ); PostQuitMessage ( 0 ); } // carica l'indirizzo di FFTwainOpen pFFTwainOpen = ( bool ( __stdcall *)( HWND ) ) GetProcAddress ( FFLibDllHandle, "FFTwainOpen" ); if ( pFFTwainOpen == NULL ) { MessageBox ( NULL, "GetProcAddress:\nFFTwainOpen non trovata.", "Errore FS 003", MB_SYSTEMMODAL ); return; } // carica l'indirizzo di FFTwainScan pFFTwainScan = ( int ( __stdcall *)( HWND, char*, int, int, int, char*, char*, int, int, int ) ) GetProcAddress ( FFLibDllHandle, "FFTwainScan" ); if ( pFFTwainScan == NULL ) { MessageBox ( NULL, "GetProcAddress:\nFFTwainScan non trovata.", "Errore FS 003", MB_SYSTEMMODAL ); return; } // carica l'indirizzo di FFTwainClose pFFTwainClose = ( void ( __stdcall *)( void ) ) GetProcAddress ( FFLibDllHandle, "FFTwainClose" ); if ( pFFTwainClose == NULL ) { MessageBox ( NULL, "GetProcAddress:\nFFTwainClose non trovata.", "Errore FS 003", MB_SYSTEMMODAL ); return; } ////////////////////////////////////////////////////////////////////// // SECTION TWO --- open the TWAIN driver ////////////////////////////////////////////////////////////////////// hWnd = Application -> Handle; pFFTwainOpen ( hWnd ); ////////////////////////////////////////////////////////////////////// // SECTION THREE --- scan a group of sheets from the feeder ////////////////////////////////////////////////////////////////////// int numberOfPagesScanned = pFFTwainScan ( hWnd, "to be printed on the image", 1, 4, 0, "C:\\ALVISE\\LAVORI\\BCB\\TWAINSCAN", "comment", 128, 1, 0 ); ////////////////////////////////////////////////////////////////////// // SECTION FOUR --- FINAL OPERATIONS ////////////////////////////////////////////////////////////////////// pFFTwainClose ( ); FreeLibrary ( FFLibDllHandle );