Twain - Wia distintion

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
benjamin
Posts: 7
Joined: Wed Oct 27, 2010 12:02 pm

Twain - Wia distintion

Post by benjamin » Wed Oct 27, 2010 12:13 pm

Hello,

I'm currently evaluating your library for image aquisition with TWAIN scanners.
For this purpose I have a Canon test device that is accesable throught both, WIA and TWAIN.
If I call "TwainSelectSource(windowHandle)" I get a list with two entries:
1# devicename
2# WIA - WIA devicename

But after calling "TwainGetSourceCount()" I loop to get all device names with "TwainGetSourceName()" and both results have now the exact same name "devicename".
How can I decide which one is the TWAIN device and which is the wrapped WIA device?

Regards,
Benjamin

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Twain - Wia distintion

Post by Loïc » Wed Oct 27, 2010 1:40 pm

Hi Benjamin,
How can I decide which one is the TWAIN device and which is the wrapped WIA device?
It's easy, just check for the 4 first chars. If it is "WIA ", this is the WIA wrapper of your driver.

Let me know if you need more information.

Loïc

benjamin
Posts: 7
Joined: Wed Oct 27, 2010 12:02 pm

Re: Twain - Wia distintion

Post by benjamin » Wed Oct 27, 2010 1:51 pm

benjamin wrote:and both results have now the exact same name "devicename".
yes, more information would be nice.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Twain - Wia distintion

Post by Loïc » Wed Oct 27, 2010 2:00 pm

Hi,

As I know you should have the exact same names.
Could you provide a print-screen of the dialog raised by TwainSelectSource & the one raised by the following code:

Code: Select all

      Dim Dev As String = ""
      For i As Integer = 1 To Imaging1.TwainGetSourceCount(Nothing)
         If i > 1 Then Dev += vbCrLf
         Dev += Imaging1.TwainGetSourceName(Nothing, i)
      Next
      MsgBox(Dev)
Loïc

benjamin
Posts: 7
Joined: Wed Oct 27, 2010 12:02 pm

Re: Twain - Wia distintion

Post by benjamin » Wed Oct 27, 2010 2:15 pm

I changed your code to this to some language incompatibilities ;-)

string devices = string.Empty;
for (int i = 0; i < TwainManager.TwainGetSourceCount(); i++)
{
devices += TwainManager.TwainGetSourceName(i);
if (i == 0)
devices += ",\n";
}
MessageBox.Show(devices);

I attached the screenshots. MsgBox.jpg is the one produced by the code above, SelectDialog.jpg the one by "TwainSelectSource(handle)".

Regards,
Benjamin
Attachments
MsgBox.jpg
MsgBox.jpg (8.35 KiB) Viewed 7726 times
SelectDialog.jpg
SelectDialog.jpg (14.43 KiB) Viewed 7726 times

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Twain - Wia distintion

Post by Loïc » Wed Oct 27, 2010 4:47 pm

damn I never seen that :shock:

Seems there is a char 0 or a line separator in your device name...

I will try to get your TWAIN driver to investigate this problem...

Kind regards,

Loïc

benjamin
Posts: 7
Joined: Wed Oct 27, 2010 12:02 pm

Re: Twain - Wia distintion

Post by benjamin » Thu Oct 28, 2010 10:32 am

Thanks for investigating this issue. If you need any further information or testing on my side then let me know.

Regards,
Benjamin

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Twain - Wia distintion

Post by Loïc » Thu Oct 28, 2010 10:36 am

Hi,

Unfortunately I am locked.
I have been able to download the driver but not able to install it because the installer requires the device...
Maybe generating a log can helps: Add TwainLogStart(logpath) in the start of your code snippet. Then report the content of the log here.

Kind regards,

Loïc

benjamin
Posts: 7
Joined: Wed Oct 27, 2010 12:02 pm

Re: Twain - Wia distintion

Post by benjamin » Thu Oct 28, 2010 11:11 am

I used DSMident method in twain_32.dll directly to access the information and in the TwIdentity record in ProductName I get the correct value: "WIA-WIA Canon MX870 ser".
The ProductFamily field would help, too. It reads "Twain Data Source On WIA" for the wrapped WIA device and "TWAIN Scanners" for the native Twain device. I don't know if this is reliable for every device but it might be another method to distinguish Twain from WIA. Is it somehow possible to read this field with your library?

Here is the log for the code snippet:

Code: Select all

#GdTwain Log Start. Version: 645

RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 1
-------------------
GetValidHwnd: Creating Proxy window.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 1
-------------------
Start: OpenSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 1
-------------------
DSM library loaded: C:\Windows\TWAIN_32.DLL
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 1
-------------------
Entry point of the DSM found.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 1
-------------------
End: OpenSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
GDTWAIN_Mgr: Start Getting DAT_STATUS
RC:   TWRC_ENDOFLIST
CC:   TWCC_SUCCESS
State: 3
-------------------
GDTWAIN_Mgr: End Getting DAT_STATUS
RC:   TWRC_ENDOFLIST
CC:   TWCC_SUCCESS
State: 3
-------------------
GDTWAIN_Mgr: Start Getting DAT_STATUS
RC:   TWRC_ENDOFLIST
CC:   TWCC_SUCCESS
State: 3
-------------------
GDTWAIN_Mgr: End Getting DAT_STATUS
RC:   TWRC_ENDOFLIST
CC:   TWCC_SUCCESS
State: 3
-------------------
GDTWAIN_Mgr: Start Getting DAT_STATUS
RC:   TWRC_ENDOFLIST
CC:   TWCC_SUCCESS
State: 3
-------------------
GDTWAIN_Mgr: End Getting DAT_STATUS
RC:   TWRC_ENDOFLIST
CC:   TWCC_SUCCESS
State: 3
-------------------

Regards,
Benjamin

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Twain - Wia distintion

Post by Loïc » Thu Oct 28, 2010 4:21 pm

Hi,

Unfortunately we miss thin function. We will add it in 7.3.

Kind regards,

Loïc

dcreeron
Posts: 35
Joined: Tue Apr 14, 2009 7:55 pm
Location: Apex, NC
Contact:

Re: Twain - Wia distintion

Post by dcreeron » Tue May 03, 2011 5:43 am

string devices = string.Empty;
for (int i = 0; i < TwainManager.TwainGetSourceCount(); i++)
{
devices += TwainManager.TwainGetSourceName(i);
if (i == 0)
devices += ",\n";
}
MessageBox.Show(devices);
Instead of iterating from 0 try starting at 1 and changing to <=. I ran into a similar issue with GdPicture.NET Ultimate v6.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests