ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder
ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 DLL keeps scanner suspended

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Format  BoldItalicizedUnderline Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailBrowse for an image to attach to your post Browse for a zip to attach to your post Insert CodeInsert QuoteInsert List


Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

Check here to subscribe to this topic.

T O P I C    R E V I E W
Craig.Weysham Posted - Apr 30 2019 : 09:27:18
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);

// DLL code:
procedure ImageEN;
  Frm: TFrmImageViewer;
  Frm := TFrmImageViewer.Create(nil);

// TFrmImageViewer
procedure TFrmImageViewer.Button1Click(Sender: TObject);

procedure TFrmImageViewer.Button2Click(Sender: TObject);
  Label2.Caption := ImgEnMIOView.MIO.SelectedAcquireSource.Name;

  Button1.Enabled := True;

// 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
    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
2   L A T E S T    R E P L I E S    (Newest First)
Craig.Weysham Posted - May 06 2019 : 09:28:25
Sorry, here is a bit more information:

Our clients use ScanSnap scanners mainly, ScanSnap Manager.

The suspended state happens when Acquire is called within the DLL that we use to interface with our clients' scanners.
Once the DLL that deals with the scanning (TwainScannerDebugging) is called within our parent app, and the button to call ImageEnMIView.MIO.Acquire is clicked; it will call the scanning window. But once the scanning is done and the dll (TwainScannerDebugging) is released from the main executable, the scanner remains in a suspended state like the executable was the one using the scanner (the scanner will return to normal once the exe is closed).

User opens our software and clicks a button to scan an image
The button calls a function within a DLL (TwainScannerDebugging.ImageEN)
The function launches a new form (TFrmImageViewer) with a button to start scanning (TFrmImageViewer.Button1)
User clicks the button (TFrmImageViewer.Button1Click)
The scanner becomes suspended here
The UI for the scanner appears and the user scans and then closes the scanner UI
The form with the button (TFrmImageViewer.Button1) to start scanning is closed (the DLL is unloaded since it is done)
This is where I would think the Scanner would see it is not used anymore, but it remains suspended
The user is returned to the original window they started
The scanner is still suspended
The user closes our software
The scanner is available again
xequte Posted - May 05 2019 : 16:31:09

Off the top of my head, I can't think of any reason this might occur.

To clarify the issue occurs when the DLL is called, even if none of the scanner methods are invoked (i.e. buttons pressed in the above code)?

Xequte Software