Language: Delphi
IDE: Delphi 10.2.3
ImageEn Version: 7.0
We use ImageEn for getting images from our clients' scanners and storing/displaying them within/from a DB. When our clients use the software, their scanner becomes suspended until the main program that calls our DLL has been closed, unloading the DLL that handles the scanning does not release the scanner it seems.
We are wondering if we could get direction on how to make the scanner available again once the DLL is closed or the scanning process is done (without closing out of the exe). This behavior seems to happen when the main executable calls a DLL that uses the TwainDSM dll.
I was not able to find much help over this, but hoping to get some help here since the software interfaces with the scanner DLL already.
Thanks for any help given.
Some code to give an example of what we do at a basic level:
// Calling EXE code:
// Delayed and Dynamic loading have the same result
procedure ImageEn; external 'TwainScannerDebugging.dll' name 'ImageEN' delayed;
.
.
.
procedure TForm1.Button1Click(Sender: TObject);
begin
ImageEn;
end;
// DLL code:
procedure ImageEN;
var
Frm: TFrmImageViewer;
begin
Frm := TFrmImageViewer.Create(nil);
try
Frm.ShowModal;
finally
FreeAndNil(Frm);
end;
end;
// TFrmImageViewer
procedure TFrmImageViewer.Button1Click(Sender: TObject);
begin
ImgEnMIOView.MIO.Acquire;
end;
procedure TFrmImageViewer.Button2Click(Sender: TObject);
begin
ImgEnMIOView.MIO.SelectAcquireSource();
Label2.Caption := ImgEnMIOView.MIO.SelectedAcquireSource.Name;
Button1.Enabled := True;
end;
// DFM
object ImgEnMIOView: TImageEnMView
Left = 1
Top = 1
Width = 216
Height = 598
Background = clBtnFace
Ctl3D = False
ParentCtl3D = False
StoreType = ietNormal
ThumbWidth = 100
ThumbHeight = 100
HorizBorder = 4
VertBorder = 4
GridWidth = 0
SelectionColor = 13542013
Style = iemsACD
ThumbnailsBackground = clBtnFace
ThumbnailsBackgroundSelected = clBtnFace
MultiSelectionOptions = []
ThumbnailsBorderWidth = 0
DefaultBottomText = iedtNone
Align = alLeft
ThumbnailResampleFilter = rfFastLinear
ThumbnailDisplayFilter = rfNone
SelectedFontColor = clNone
MouseWheelParams.Action = iemwVScroll
MouseWheelParamsAlt.Action = iemwZoom
TabOrder = 0
end
object ImgEnView: TImageEnView
Left = 217
Top = 1
Width = 796
Height = 598
Background = clBtnFace
Ctl3D = False
ParentCtl3D = False
LegacyBitmap = True
EnableInteractionHints = True
MouseWheelParams.Action = iemwZoom
Align = alClient
TabOrder = 1
end