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
 SelectedAquireSource.api error

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
Matthew T Posted - May 31 2012 : 14:08:01
Hi,

I have an TImageEnView and wanted to save the SelectedAquireSource to the registry so the user does not have to select it each time (there might be more than one network scanner on their network. I also wanted to display the currently selected scanner.

1) I am getting an Access Violation when trying to display the currently selected device:

if ImageEnView.IO.SelectedAcquireSource.Api = ieaNone then
LSelectedSource.Caption := 'No device selected'
else
LSelectedSource.Caption := ImageEnView.IO.SelectedAcquireSource.Name;

The error occurs on the if statement.

2) I have a setup program which I have another ImageEnView control. From there I populate a combobox from the twain and wia params:


AcquireApis := [ieaTwain, ieaWIA];
for i := 0 to ImageEnView.IO.TwainParams.SourceCount - 1 do
cxCBScanners.Properties.Items.Add(ImageEnView.IO.TwainParams.SourceName[i]);
for i := 0 to ImageEnView.IO.WIAParams.DevicesInfoCount -1 do
cxCBScanners.Properties.Items.Add(ImageEnView.IO.WIAParams.DevicesInfo[i].Name);

After the user selects the scanner, I save the name to the registry.

When the user goes to the scan program, I want to set the ImageEnView to use the scanner selected in the setup.

if Scanner <> '' then
begin
ADevice := StrToAcquireSource(scanner);
// this causes an exception: Invalid Raw Str
ImageEnView.IO.AcquireParams.SetSource(aDevice.Api, aDevice.Location)
end

This bombs out. Any suggestions?

Thanks,

Matthew
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jun 04 2012 : 17:02:57
Hi Matthew

1. This will be fixed in the next update

2. TwainParams.SourceName and ImageEnView.IO.WIAParams.DevicesInfo[i].Name list only the names of the devices which cannot be passed to set source.

You should use:

ImageEnView.IO.AcquireParams.FillListWithSources(cxCBScanners.Properties.Items, [ieaTwain, ieaWIA], False);

To fill your combo, then that string can be passed back using

ImageEnView.IO.AcquireParams.SetSourceByStr(sRawDeviceStr);

Note that this will give you an ugly display string so you should custom draw the combobox. This can be done quite easily if you see the AllAcquire.dpr demo at:

http://www.imageen.com/demos/index.html#ImageAcquisition



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com