Retrieves the Guid structure for any WIA property of type WiaVariableTypes.Clsid .
public Guid GetPropertyGuid(
object item,
string propertyIdName,
WiaPropertyId propertyId
)
Public Function GetPropertyGuid( _
ByVal item As Object, _
ByVal propertyIdName As String, _
ByVal propertyId As Leadtools.Wia.WiaPropertyId _
) As Guid
public:
Guid GetPropertyGuid(
Object^ item,
String^ propertyIdName,
Leadtools.Wia.WiaPropertyId propertyId
)
item
Handle to the item which represents the item having the property. You can retrieve this parameter by either calling the GetRootItem method to get the device's root item itself or by enumerating the child items of the device through a call to EnumChildItems method.
propertyIdName
This string should contain the equivalent property Id string for the WIA property ID. Use the see GetPropertyIdString method to get this string for the property ID.
If you passed null for this parameter then the WIA toolkit will use the property ID passed through the third parameter propertyId**; otherwise this parameters will be used whether or not you passed valid property ID through the propertyId parameter
propertyId
The property ID for the value being sought, for list of available property IDs see WiaPropertyId.
This parameter is required only if the second parameter "propertyIdName"is null; otherwise you can pass 0 for this parameter.
The WIA GUID value.
Any WIA property of type WiaVariableTypes.Clsid (for example, WiaPropertyId.ItemFormat ) returns a Guid structure. In order to retrieve this type of properties you need to call the function GetPropertyGuid.
For more information, refer to Managing WIA Sources.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Wia;
WiaSession mySession;
public void GetPropertyGuidExample(IntPtr parent)
{
if (!WiaSession.IsAvailable(WiaVersion.Version1))
{
MessageBox.Show("WIA version 1.0 not installed.");
return;
}
mySession = new WiaSession();
mySession.Startup(WiaVersion.Version1);
DialogResult res = mySession.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault);
if (res != DialogResult.OK)
{
MessageBox.Show("Error selecting WIA device.");
mySession.Shutdown();
return;
}
object rootItem = mySession.GetRootItem(null);
if (rootItem != null)
{
mySession.EnumItemsEvent += new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent3);
mySession.EnumChildItems(rootItem);
mySession.EnumItemsEvent -= new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent3);
}
mySession.Shutdown();
}
void wiaSession_EnumItemsEvent3(object sender, WiaEnumItemsEventArgs e)
{
bool found = false;
if (e.Item != null)
{
// Read the item category property (this property is only available for WIA 2.0).
Guid sessionCategoryGuid = mySession.GetPropertyGuid(e.Item, null, WiaPropertyId.ItemCategory);
// Find the related item category for the received Guid.
Guid categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Feeder);
if (categoryGuid == sessionCategoryGuid) // the item is a Feeder.
{
Console.WriteLine("Item category: Feeder");
found = true;
}
if (found == false)
{
categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.FeederBack);
if (categoryGuid == sessionCategoryGuid) // the item is a Feeder.
{
Console.WriteLine("Item category: FeederBack");
found = true;
}
}
if (found == false)
{
categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.FeederFront);
if (categoryGuid == sessionCategoryGuid) // the item is a Feeder.
{
Console.WriteLine("Item category: FeederFront");
found = true;
}
}
if (found == false)
{
categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Film);
if (categoryGuid == sessionCategoryGuid) // the item is a Feeder.
{
Console.WriteLine("Item category: Film");
found = true;
}
}
if (found == false)
{
categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.FinishedFile);
if (categoryGuid == sessionCategoryGuid) // the item is a Feeder.
{
Console.WriteLine("Item category: FinishedFile");
found = true;
}
}
if (found == false)
{
categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Flatbed);
if (categoryGuid == sessionCategoryGuid) // the item is a Feeder.
{
Console.WriteLine("Item category: Flatbed");
found = true;
}
}
if (found == false)
{
categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Folder);
if (categoryGuid == sessionCategoryGuid) // the item is a Feeder.
{
Console.WriteLine("Item category: Folder");
found = true;
}
}
if (found == false)
{
categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Root);
if (categoryGuid == sessionCategoryGuid) // the item is a Feeder.
{
Console.WriteLine("Item category: Root");
found = true;
}
}
mySession.FreeItem(e.Item);
}
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Wia
Dim mySession As WiaSession
<TestMethod()> _
Public Sub GetPropertyGuidExample(ByVal parent As IntPtr)
If (Not wiaSession.IsAvailable(WiaVersion.Version1)) Then
MessageBox.Show("WIA version 1.0 not installed.")
Return
End If
mySession = New WiaSession()
mySession.Startup(WiaVersion.Version1)
Dim res As DialogResult = mySession.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault)
If res <> DialogResult.OK Then
MessageBox.Show("Error selecting WIA device.")
mySession.Shutdown()
Return
End If
Dim rootItem As Object = mySession.GetRootItem(Nothing)
If Not rootItem Is Nothing Then
AddHandler mySession.EnumItemsEvent, AddressOf session_EnumItemsEvent3
mySession.EnumChildItems(rootItem)
RemoveHandler mySession.EnumItemsEvent, AddressOf session_EnumItemsEvent3
End If
mySession.Shutdown()
End Sub
Private Sub session_EnumItemsEvent3(ByVal sender As Object, ByVal e As WiaEnumItemsEventArgs)
Dim found As Boolean = False
If Not e.Item Is Nothing Then
' Read the item category property (this property is only available for WIA 2.0).
Dim sessionCategoryGuid As Guid = mySession.GetPropertyGuid(e.Item, Nothing, WiaPropertyId.ItemCategory)
' Find the related item category for the received GUID.
Dim categoryGuid As Guid = wiaSession.GetCategoryGuid(WiaCategories.Feeder)
If categoryGuid = sessionCategoryGuid Then ' the item is a Feeder.
Console.WriteLine("Item category: Feeder")
found = True
End If
If found = False Then
categoryGuid = wiaSession.GetCategoryGuid(WiaCategories.FeederBack)
If categoryGuid = sessionCategoryGuid Then ' the item is a Feeder.
Console.WriteLine("Item category: FeederBack")
found = True
End If
End If
If found = False Then
categoryGuid = wiaSession.GetCategoryGuid(WiaCategories.FeederFront)
If categoryGuid = sessionCategoryGuid Then ' the item is a Feeder.
Console.WriteLine("Item category: FeederFront")
found = True
End If
End If
If found = False Then
categoryGuid = wiaSession.GetCategoryGuid(WiaCategories.Film)
If categoryGuid = sessionCategoryGuid Then ' the item is a Feeder.
Console.WriteLine("Item category: Film")
found = True
End If
End If
If found = False Then
categoryGuid = wiaSession.GetCategoryGuid(WiaCategories.FinishedFile)
If categoryGuid = sessionCategoryGuid Then ' the item is a Feeder.
Console.WriteLine("Item category: FinishedFile")
found = True
End If
End If
If found = False Then
categoryGuid = wiaSession.GetCategoryGuid(WiaCategories.Flatbed)
If categoryGuid = sessionCategoryGuid Then ' the item is a Feeder.
Console.WriteLine("Item category: Flatbed")
found = True
End If
End If
If found = False Then
categoryGuid = wiaSession.GetCategoryGuid(WiaCategories.Folder)
If categoryGuid = sessionCategoryGuid Then ' the item is a Feeder.
Console.WriteLine("Item category: Folder")
found = True
End If
End If
If found = False Then
categoryGuid = wiaSession.GetCategoryGuid(WiaCategories.Root)
If categoryGuid = sessionCategoryGuid Then ' the item is a Feeder.
Console.WriteLine("Item category: Root")
found = True
End If
End If
session.FreeItem(e.Item)
End If
End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET