Retrieve scanner serial number
Retrieve scanner serial number
Is there any code available to retrieve the serial number of the scanner currently being used?
Re: Retrieve scanner serial number
Hello Chris,
There is an enumeration in the TWAIN that is called CAP_SERIALNUMBER. But it is optional, you cannot assume that a scanner supports it.
-> https://www.gdpicture.com/guides/gdpict ... ities.html
At the moment, I didn't see any method in our SDK that can get the serial number. I'll check that with the devs and if we do not have it, I'll create a ticket to implement this feature.
I'll keep you posted about it!
With best,
Fabio
There is an enumeration in the TWAIN that is called CAP_SERIALNUMBER. But it is optional, you cannot assume that a scanner supports it.
-> https://www.gdpicture.com/guides/gdpict ... ities.html
At the moment, I didn't see any method in our SDK that can get the serial number. I'll check that with the devs and if we do not have it, I'll create a ticket to implement this feature.
I'll keep you posted about it!
With best,
Fabio
Re: Retrieve scanner serial number
Hello Fabio,
I know my scanner supports the serial number capability. I am using a fujitsu fi-7160 for my software and testing. I added code in the example demo code that was bundled with the sdk to get the serial number
Which i am assuming would get me the serial number but it just returns true or false.
I will keep searching different settings to see if i can retrieve it, but i will also wait for a reply from you as well.
I know my scanner supports the serial number capability. I am using a fujitsu fi-7160 for my software and testing. I added code in the example demo code that was bundled with the sdk to get the serial number
Code: Select all
MessageBox.Show(gdpictureImaging.TwainGetCapDefaultString(TwainCapabilities.CAP_SERIALNUMBER, ref strSerialNumber).ToString());
I will keep searching different settings to see if i can retrieve it, but i will also wait for a reply from you as well.
Re: Retrieve scanner serial number
Hi there,
You are displaying the retuned value of the method which is a status. Your value will be stored into the variable passed by reference, in your case: strSerialNumber
I hope this helps.
With best regards,
Loïc
You are displaying the retuned value of the method which is a status. Your value will be stored into the variable passed by reference, in your case: strSerialNumber
I hope this helps.
With best regards,
Loïc
Re: Retrieve scanner serial number
Also you probably want to use the TwainGetCapCurrentString() method instead.
https://www.gdpicture.com/guides/gdpict ... tring.html
so:
https://www.gdpicture.com/guides/gdpict ... tring.html
so:
Code: Select all
If gdpictureImaging.TwainGetCapDefaultString(TwainCapabilities.CAP_SERIALNUMBER, ref strSerialNumber) = True Then
MessageBox.Show(strSerialNumber);
Else
MessageBox.Show("Failed to obtain the specified capability value"); ' ---> see Remark section of the mentioned link.
Else If
Re: Retrieve scanner serial number
Hello Loic,
I did try the TwainGetCapDefaultString method prior and still did not receive the correct result. i copied the code you provided and did some more testing, which i received the failed error message. I dont know why i was thinking of where i placed my previous code, but i moved the code you provided further up in the example where i set the other twain settings and i did not receive any error messages or the failed error message. I did receive the serial number of my scanner.
i believe if i would have placed my code in the different section, i would have received the serial number.
This is ok, because now i know how helpful this forum is. The responses were great.
I appreciate all the help. I will also continue to wait for Fabio's reply and update.
If i have any issues or questions i will definitely be posting to the forums.
I did try the TwainGetCapDefaultString method prior and still did not receive the correct result. i copied the code you provided and did some more testing, which i received the failed error message. I dont know why i was thinking of where i placed my previous code, but i moved the code you provided further up in the example where i set the other twain settings and i did not receive any error messages or the failed error message. I did receive the serial number of my scanner.
i believe if i would have placed my code in the different section, i would have received the serial number.
This is ok, because now i know how helpful this forum is. The responses were great.
I appreciate all the help. I will also continue to wait for Fabio's reply and update.
If i have any issues or questions i will definitely be posting to the forums.
Re: Retrieve scanner serial number
Hello Chris,
I'm sorry I'm not sure to understand. Loïc came back to you after seeing the ticket I created regarding your need.
Does the proposed solution isn't suitable on your side?
With best,
Fabio
I'm sorry I'm not sure to understand. Loïc came back to you after seeing the ticket I created regarding your need.
Does the proposed solution isn't suitable on your side?
With best,
Fabio
Re: Retrieve scanner serial number
Yes, the proposed solution worked. i was just waiting on a response from the you, Fabio, if there was going to be some type of implementation for retrieving the serial number within the SDK. I am in early development stages of my software re-write and if i needed to possibly wait for a newer updated SDK, i would wait to release my software.
Re: Retrieve scanner serial number
Hi,
I'm sorry but since the TwainGetCapDefaultString does the job of getting the serial number, I do not think it will be relevant to implement such a feature.
With best,
Fabio
I'm sorry but since the TwainGetCapDefaultString does the job of getting the serial number, I do not think it will be relevant to implement such a feature.
With best,
Fabio
Re: Retrieve scanner serial number
Yes, it is possible to retrieve the serial number of the scanner currently being used in a programmatic way. However, the exact code may vary depending on the type of scanner and the programming language being used. Here is an example: contexto
Code: Select all
using WIA;
// Create a new WIA device manager
var deviceManager = new DeviceManager();
// Get the collection of available devices
var devices = deviceManager.DeviceInfos;
// Iterate through the devices to find the scanner and retrieve its serial number
foreach (DeviceInfo deviceInfo in devices)
{
// Check if the device is a scanner
if (deviceInfo.Type == WiaDeviceType.ScannerDeviceType)
{
// Retrieve the scanner object
var scanner = deviceInfo.Connect();
// Retrieve the serial number of the scanner
var serialNumber = (string)scanner.Properties["Serial Number"].get_Value();
// Display the serial number
Console.WriteLine($"Serial number of the scanner: {serialNumber}");
}
}
Who is online
Users browsing this forum: No registered users and 2 guests