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
 How can I detect if a scanning device is ready

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

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
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
Merlin Posted - Apr 17 2024 : 07:02:13
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
7   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jul 20 2024 : 14:56:07
Thanks Fritz

Nigel
Xequte Software
www.imageen.com
fritzkunkel Posted - Jul 20 2024 : 06:39:18
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
xequte Posted - May 28 2024 : 19:09:40
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
Merlin Posted - May 27 2024 : 23:21:28
Hello,


yes sure, here you are

The scanner model is a Avision AV332U.


attach/Merlin/2024527232057_twainlog.zip
976 Bytes
xequte Posted - May 27 2024 : 17:06:44
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
Merlin Posted - May 27 2024 : 00:08:10
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
xequte Posted - Apr 17 2024 : 21:51:12
Hi

How about DeviceOnline?

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

Nigel
Xequte Software
www.imageen.com