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
 SetAcquireSource error
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

John

USA
94 Posts

Posted - Mar 21 2014 :  14:10:34  Show Profile  Reply
Hello

For SetAcquireSource, the help file states the following.
"Programatically set the selected acquisition source by an API type and device. The selected device will be used for subsequent calls to Acquire. Result is false if the device cannot be selected (i.e. is not connected or does not exist)."

However, the following if statement returns true even if the scanner is not attached.


var
tempDefaultScannerLocation: Integer

if ImageEnView1.IO.SetAcquireSource(ieaTwain, tempDefaultScannerLocation) = True then
showmessage('true')
else
showmessage('false');


Is this an error or am I missing something?

TIA

John

w2m

USA
1990 Posts

Posted - Mar 21 2014 :  14:24:25  Show Profile  Reply
John,

The ImageEn Twain can detect if the twain drivers are installed in windows, but the ImageEn Twain or for that matter any twain can not be used to determine if the scanner is turned on. You can search for this on the web, but you will find there is no way to determine if a scanner is on via twain.

This approach works with digital camera and WIA, but there is no method you can call to know if a camera is plugged in or turned on:
for i := 0 to ImageEnView1.IO.WIAParams.DevicesInfoCount - 1 do
  if ImageEnView1.IO.WIAParams.DevicesInfo[i].DeviceType = iewDigitalCamera
    then
      Camera1.Items.Add(ImageEnView1.IO.WIAParams.DevicesInfo[i].Name);
  if Camera1.Items.Count = 0 then
  'Camera is not plugged in or turned on'

I just tried this with a usb HP Scanner..
if ImageEnView1.IO.WIAParams.DevicesInfo[i].DeviceType = iewScanner;

Even though the scanner is off there still is a device loaded into the combobox. So I guess it depends on the devices software implementation.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: