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 to get scanner DPI capability

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
Homer Posted - Dec 07 2021 : 20:47:27
I would like to populate a combobox list with the DPI values the scanner is capable of. In a very old version I used to use the following in a procedure that could compute the resolutions available. In D2007, code completion says this is legal, but it creates an error. Can someone show me the way?

MyDouble := ImageEnMView1.MIO.TwainParams.XResolution.RangeMax
8   L A T E S T    R E P L I E S    (Newest First)
Homer Posted - Jan 09 2022 : 04:09:57
I don't think I'll ever need WIA so Twain should be fine. Also things seem a little faster when I "ignore" WIA. I've never promised anything other than Twain compliance to my users anyway.
xequte Posted - Jan 07 2022 : 00:39:16
Hi

This is only valid for Twain devices:

ImageEnMView1.MIO.TwainParams.XResolution.RangeMax

What is the API of the selected source?

Nigel
Xequte Software
www.imageen.com
Homer Posted - Jan 04 2022 : 14:11:13
For now, I'm just going to assume that all modern scanners can handle resolution from 100 to 1200, and trap errors that might occur. If there's a better way, I'd love to know.
Homer Posted - Jan 04 2022 : 13:31:08
Now that I have a work-around for the error originally reported, the sample code always returns 0 (zero/zed). However,
FloatToStr(frmMain.ImageEnMView1.MIO.AcquireParams.XResolution));
returns the scanner's current setting. Also,
frmMain.ImageEnMView1.MIO.AcquireParams.XResolution := 2400.0;
sets the scanner's DPI to 2400. At least that's what is returned with the above code example.
So, I know how to set and get the DPI, but I don't know how to get the DPI range the scanner is able to support. What am I doing wrong in the procedure originally posted? I would to use that to populate the list of my DPI combo box.
Homer Posted - Dec 09 2021 : 11:07:13
I've removed the old ImageEn entries. Now when I open Delphi I get the following message (and many like it):

The procedure entry point @Iexlayerprops@TIELayerProps@ could not be located in the dynamic link library C:\ProgramData\ImageEn\Delphi2007\DPKIECTRL11.BPL.

I have started a new thread with a more meaningful subject line:

https://www.imageen.com/ieforum/topic.asp?TOPIC_ID=5179
xequte Posted - Dec 08 2021 : 15:02:01
That code looks good. Are you able to reproduce the error in any of our demos?

I'm a little concerned that you are still seeing the "unregistered" warning, which does not happen with the new components.

You might want to try resetting your ImageEn state:
Search your system for any PKIE*.* and DPKIE*.* files and remove them (it might help to review the library paths under Tools > Options, Library). Then reinstall ImageEn.


Nigel
Xequte Software
www.imageen.com
Homer Posted - Dec 08 2021 : 11:34:03
There is no error message. When that statement executes, the program crashes and the IDE displays the CPU page. The code that is causing this problem worked fine when I was running ImageEn 2.1. I'll include the actual code below:

I don't know if this matters, but the old "unregistered" banner still appears in the IDE, but not at runtime.


procedure TfrmABSinterface.GetAvailableDPI;
var
  i, iMaxX, IMaxY, Imax : integer;
begin

     try
           {----- Get Maximum Available Resolution (DPI) from the device. }
        iMaxX := Trunc(frmMain.ImageEnMView1.MIO.TwainParams.XResolution.RangeMax);
        iMaxY := Trunc(frmMain.ImageEnMView1.Mio.TWainParams.YResolution.RangeMax);
           {----- Pick the lowest between X and Y because we only display one value.}
        if iMaxX > iMaxY then
          iMax := iMaxY
        else
          iMax := iMaxX;
           {----- The array max is 10 so don't go beyond.}
        if iMax > 10 then
          iMax := 10;
           {----- We can't read DPI. ASSUME scanner can 300 DPI.}
        if iMax = 0 then
          iMax := 4;
           {----- Populate the combobox items}
        For i := 0 to iMax do
        begin
          if DPI[i] > DPI[iMax] then
            Break;
          cboResolution.Items.Add( IntToStr(DPI[i]) + ' Dots per inch.');
        end;
           {----- Set the cbo text value to match one in the list.}
        if iMax >= 2 then
          cboResolution.ItemIndex := 2
        else
          cboResolution.ItemIndex := iMax;
     except
        on E: Exception do
        begin
          ShowMessage(E.Message);
        end;
     end;
end;
xequte Posted - Dec 08 2021 : 00:30:50
What is the error that you get?



Nigel
Xequte Software
www.imageen.com