ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How can I detect if a scanning device is ready
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Merlin

Germany
4 Posts

Posted - Apr 17 2024 :  07:02:13  Show Profile  Reply
Hello,


what can I do, when I want to know that my twain scanning device is still ready to scan? There is no status property for my device, similar to the status property of my printing devices (online, offline, ...)

Sometimes, the device changes into standby or off mode to save energy.

Thank you

xequte

38608 Posts

Posted - Apr 17 2024 :  21:51:12  Show Profile  Reply
Hi

How about DeviceOnline?

http://www.imageen.com/help/TIETwainParams.DeviceOnline.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Merlin

Germany
4 Posts

Posted - May 27 2024 :  00:08:10  Show Profile  Reply
Hello,


thank you.
Hmm, I have to select my device first via this call?

ImageEnView1.IO.TwainParams.SelectedSource := <myTwainDevice>


If yes, this call produces also an error message dialog, when the device is still not ready




Please how can get rid of this dialog?
Thank you
Go to Top of Page

xequte

38608 Posts

Posted - May 27 2024 :  17:06:44  Show Profile  Reply
Hmmm, that is an error from your scanner driver.

Can you generate a log for us:

http://www.imageen.com/help/TIETwainParams.LogFile.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Merlin

Germany
4 Posts

Posted - May 27 2024 :  23:21:28  Show Profile  Reply
Hello,


yes sure, here you are

The scanner model is a Avision AV332U.


attach/Merlin/2024527232057_twainlog.zip
976 Bytes
Go to Top of Page

xequte

38608 Posts

Posted - May 28 2024 :  19:09:40  Show Profile  Reply
Hi

Unfortunately this driver shows the warning message in MSG_OPENDS, so we have no way to check it beforehand, or prevent it from activating (cannot avoid showing the warning dialog).


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

fritzkunkel

10 Posts

Posted - Jul 20 2024 :  06:39:18  Show Profile  Reply
Hi Merlin.

I hope, I can help with following (Simplified source)
To prevent problems caused by the scanner being switched off or (mostly) in energy saving mode, we use a 'ScannerCheck' before each scan:


Function TDataModule1.ScannerCheck(Source:String):Boolean;
// 'Source' is stored in a database or ini or registry...
var aImageEnIO:TImageEnIO;
    NewSource:String;
    ADevice : TIEAcquireSource;
begin
     result := FALSE;
     NewSource := Source;
     ADevice := StrToAcquireSource(Source);
     aImageEnIO := TImageEnIO.Create(self);
     try
        result := aImageEnIO.SetAcquireSource(ADevice.Api, ADevice.Location);
        if result then result :=  aImageEnIO.TwainParams.GetFromScanner;
        if (Source = '') or (not result) then
        begin
             ShowMessage('Scanner ist nicht bereit'+#13#10+
             'Ist der Scanner korrekt angeschlossen und eingeschaltet?');
             // ... dann Scanner auswählen
             result := aImageEnIO.SelectAcquireSource([ieaTwain, ieaWIA]);
             if result then
                NewSource := AcquireSourceToStr(aImageEnIO.SelectedAcquireSource);
             if NewSource <> Source then
             begin
                  // wollen Sie wirklich diesen Scanner auswählen:
                  // NewAcquisitionSource
                  // wenn ja, dann
                  ADevice := StrToAcquireSource(NewSource);
                  if MessageDlg('Wollen Sie diesen Scanner auswählen:?'+
                     +#13#10+AcquireSourceToStr(ADevice), mtConfirmation,
                     [mbYes, mbNo], 0, mbYes) = mrYes then
                  begin
                       Source := NewSource;
                       // store 'Source' to a database or ini or registry...
                       result :=  aImageEnIO.TwainParams.GetFromScanner;
                  end else result := FALSE;
             end;
        end;
     finally
        aImageEnIO.Free;
     end;
end;

procedure TMainForm.TestScanButtonClick(Sender: TObject);
var oldCursor:TCursor;
begin
     if not DataModule1.ScannerCheck then exit;
     oldCursor := Screen.Cursor;
     Screen.Cursor := crHourGlass;
     try
        result := MainForm.ImageEnIO1.Acquire;
     finally
        Screen.Cursor := oldCursor;
        SelectedBitmap.Assign(ImageEnIO1.IEBitmap);
        // or ImageEnView.IEBitmap.Assign(ImageEnIO1.IEBitmap);
     end;
end;

Fritz
Go to Top of Page

xequte

38608 Posts

Posted - Jul 20 2024 :  14:56:07  Show Profile  Reply
Thanks Fritz

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: