- This topic has 0 replies, 1 voice, and was last updated 14 years, 3 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
Forums › TWAIN Classic › Problems with exit from scaner Dll
❓
Hi everybody. I have a problem in my dinamic library, which calling twain_32.dll. I wrote Dll in IDE C++ Builder 5. Problem happen when i close window working dll and try working in application, which called my dll.
Window in this application is suspensioning and not reply for actions mouse or keyboard.
This programming code my library:
extern HANDLE TwainInst;
//check exists twain_32.dll
TwainExists();
//function scanning
….
HANDLE dib = TwainGetImage(Handle);
if ( dib == 0 )
return false;
try
{
Bitmap=new Graphics::TBitmap();
LPBITMAPINFO bmi = (LPBITMAPINFO)::GlobalLock(dib);
Bitmap->Height = bmi->bmiHeader.biHeight;
Bitmap->Width = bmi->bmiHeader.biWidth;
SetDIBits(Bitmap->Canvas->Handle,Bitmap->Handle, 0,
(UINT) bmi->bmiHeader.biHeight,
(Byte*)((Byte*)bmi + sizeof(BITMAPINFOHEADER)),
bmi, DIB_RGB_COLORS );
}
__finally
{
::GlobalUnlock( dib );
::GlobalFree( dib );
}
//Free library
…
FreeLibrary( TwainInst );
What is wrong with it? Sorry for my bad English.