T O P I C R E V I E W |
Homer |
Posted - Dec 30 2021 : 19:28:40 This was discussed a little in this thread: https://www.imageen.com/ieforum/topic.asp?whichpage=1&TOPIC_ID=5199#18116 I started this one because I have more information and I think the question is quite different. I'm really not trying to double post. I just have more information, as well as more and different questions.
My app gives my users the choice of using my homemade dialog or the one that belongs to their scanner. Mine is very simple, and looks like this:
I've been testing with an HP scanner. Its dialog looks like this:
If the first dialog that is opened is the HP scanner's (immediately above), it looks normal and behaves as such. However, if I open my dialog first, do a scan, and then try to do another scan using the HP dialog, the following is what opens. It is normally a lower z-order so it is hidden behind my app's main form. Also, this same dialog is the one that opens when I use the AllAcquire demo.
I have looked for other apps on my computer that might display this dialog and, as far as I know, there are none. The Windows Fax & Scan app looks similar, but not the same.
Questions: - Is this dialog built into ImageEn?
- Should I be freeing something that I'm not after I create my own dialog?
- Is there a better way to show the scanner manufactures dialog?
My Code for opening the scanner supplied dialog:
procedure TfrmMain.mnuScannerdialogClick(Sender: TObject);
begin
try
Screen.Cursor := crHourglass;
ImageEnMView1.Clear;
ImageEnMView1.MIO.AcquireParams.VisibleDialog := True;
Application.ProcessMessages;
Try
case iDefaultImageFormat of
0:begin {JPG}
ImageEnView1.IO.Params.JPEG_Quality := giJPEG_Better;
if not ImageEnView1.IO.Acquire then exit;
NewFileName := GetFileName(gsDocManPath, '.JPG');
ImageEnView1.IO.SaveToFile(gsDocManPath + NewFileName);
end;
1:begin {PNG}
NewFileName := GetFileName(gsDocManPath, '.PNG');
ImageEnView1.IO.Params.PNG_Compression:=9;
ImageEnView1.IO.Params.PNG_Interlaced := False;
if not ImageEnView1.IO.Acquire then exit;
ImageEnView1.IO.SaveToFile(gsDocManPath + NewFileName);
end;
2:begin {PDF}
ImageEnMView1.Clear;
if not ImageEnMView1.MIO.Acquire then exit;
Application.ProcessMessages;
NewFileName := frmMain.GetFileName(gsDocmanPath, '.PDF');
ImageEnMView1.MIO.SaveToFilePDF(gsDocManPath + NewFileName);
end;
end;
// Save Image info to database.
Application.ProcessMessages;
qImageList.Append ; { Append New image info to database. }
qImageList.FieldByName('FK_ID').AsInteger := StrToInt(gsHHkey);
qImageList.FieldByName('ImageName').AsString := NewFileName;
qImageList.FieldByName('Caption').AsString := 'Scanned '+ DateTimeToStr(Now);
qImageList.FieldByName('DateStamp').AsDateTime:= Date;
qImageList.FieldByName('HHName').AsString := AccountName;
Application.ProcessMessages;
qImageList.Post;
Application.ProcessMessages;
RzStatusPane3.Caption := 'File: ' + qImageList.FieldByName('ImageName').AsString;
Except
MessageBox(Application.Handle,
PChar('Unable to save this document. Please try to save it manually.'),
PChar('FYI'), MB_OK + MB_ICONINFORMATION);
end;
RzProgressBar1.Percent := 0;
Application.ProcessMessages;
cxgrdGrid1DBTableView1.NavigatorButtons[12].Click;
finally
Screen.Cursor := crDefault;
end;
end;
|
5 L A T E S T R E P L I E S (Newest First) |
Homer |
Posted - Jan 03 2022 : 18:21:09 Would you look at that. Thanks for the link. That helps a lot. My scalp was getting sore from scratching my head. :-) |
xequte |
Posted - Jan 03 2022 : 15:30:25 Hi
It is only used if you scan with WIA. Also, you can see the same dialog pops up with other scanner types, such as Brother:
https://support.brother.com/g/s/id/htmldoc/mfc/dcp9045cdn/gb/html/sug/chapter2_2_2.html
Nigel Xequte Software www.imageen.com
|
Homer |
Posted - Jan 02 2022 : 12:38:51 Limiting the choices seems like a good suggestion. I'll try that. Thanks for your help. It really saves a lot of head scratching.
The smaller grey dialog may be the Windows dialog, but I wonder. What makes me think it is not, is the following dialog that opens when I select the Windows Fax & Scan software that came with Windows 8.1. It's very similar, but not quite the same. If HP thinks like I do, they want to minimize the reliance on someone else's software being there forever.
|
xequte |
Posted - Jan 01 2022 : 14:05:34 Hi
Your code above looks correct.
The gray dialog is a Windows WIA acquisition dialog, I believe (i.e. comes up when you scan with WIA). You might try showing the dialog only showing a ieaTwain devices and see which ones correct. Generally it is best to use Twain.
It should not be necessary to show the Device selection dialog before scanning, so it sounds like something is going on there.
I'll add double-clicking in that dialog in our next update.
Nigel Xequte Software www.imageen.com
|
Homer |
Posted - Dec 31 2021 : 13:24:55 MYSTERY SOLVED (I think). I hope the following helps anyone who runs into this situation.
Out of frustration I reverted back to the code I used with ImageEn 2.x, before upgrading to 10.x. The only real difference was the old code opened the device selection dialog prior to the scanner dialog. That's when I discovered the source of the problem. When I re-wrote for the 10.x upgrade, I put device selection elsewhere so the user could establish a default, and not be forced to select the same scanner every time. My users do a lot of scanning.
The v2.x opened the device selection dialog just before opening the scanner dialog. That's when I learned that my HP scanner apparently has multiple dialogs depending on which device (driver?) is selected.
Perhaps the following will help anyone running into this situation.
These Selections produced: A: The dialog I expected -- the big white pretty one that obviously matches the scanner. B: The smaller one I questioned. It opened at the top left (0,0). C: Same as B. D: A completely different dialog asking "Which pictures do you want to copy?" E: Same as B except centered - not at the top left (0,0). F: Same as E. G: Same as D.
None of these were hidden (the z-order was correct). Apparently opening the device selection dialog first was the secret. I don't think that should be necessary, but apparently it is.
So, my HP ENVY Photo 7855 comes with three different dialogs to serve different purposes. It's only one physical device so, for people who do a lot of scanning it would be nice to be able to establish a default so they can go directly to scanning. Also, it would be nice, on the device selection dialog, if the user could just double click the device with out needing to click the button. In other words the double click would select, and then do a button.click.
|
|
|