Retrieves the 
Guid structure 
            for any WIA property of type 
            
WiaVariableTypes.Clsid
            .
             
             
             
            
Syntax
| Visual Basic (Usage) |  Copy Code | 
|---|
Dim instance As WiaSession
Dim item As Object
Dim propertyIdName As String
Dim propertyId As WiaPropertyId
 
instance.GetPropertyGuid(item, propertyIdName, propertyId)
  | 
 
            Parameters
- item
 
- Handle to the item which represents the item having the property. You can retrieve this parameter by either calling the 
            WiaSession.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.
 
             
              
             
             
            
Example
 
             
| Visual Basic |  Copy Code | 
|---|
Dim mySession As WiaSession 
Public Sub GetPropertyGuidExample(ByVal parent As IWin32Window) 
   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 
 
   mySession.GetRootItem(Nothing) 
   If Not mySession.RootItem Is Nothing Then 
      AddHandler mySession.EnumItemsEvent, AddressOf session_EnumItemsEvent3 
 
      mySession.EnumChildItems(mySession.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 
       
      mySession.GetPropertyGuid(e.Item, Nothing, WiaPropertyId.ItemCategory) 
 
       
      WiaSession.GetCategoryGuid(WiaCategories.Feeder) 
      If wiaSession.CategoryGuid = mySession.GuidValue Then  
         Console.WriteLine("Item category: Feeder") 
         found = True 
      End If 
 
      If found = False Then 
         WiaSession.GetCategoryGuid(WiaCategories.FeederBack) 
         If WiaSession.CategoryGuid = mySession.GuidValue Then  
            Console.WriteLine("Item category: FeederBack") 
            found = True 
         End If 
      End If 
 
      If found = False Then 
         WiaSession.GetCategoryGuid(WiaCategories.FeederFront) 
         If wiaSession.CategoryGuid = mySession.GuidValue Then  
            Console.WriteLine("Item category: FeederFront") 
            found = True 
         End If 
      End If 
 
      If found = False Then 
         WiaSession.GetCategoryGuid(WiaCategories.Film) 
         If wiaSession.CategoryGuid = mySession.GuidValue Then  
            Console.WriteLine("Item category: Film") 
            found = True 
         End If 
      End If 
 
      If found = False Then 
         WiaSession.GetCategoryGuid(WiaCategories.FinishedFile) 
         If wiaSession.CategoryGuid = mySession.GuidValue Then  
            Console.WriteLine("Item category: FinishedFile") 
            found = True 
         End If 
      End If 
 
      If found = False Then 
         WiaSession.GetCategoryGuid(WiaCategories.Flatbed) 
         If wiaSession.CategoryGuid = mySession.GuidValue Then  
            Console.WriteLine("Item category: Flatbed") 
            found = True 
         End If 
      End If 
 
      If found = False Then 
         WiaSession.GetCategoryGuid(WiaCategories.Folder) 
         If wiaSession.CategoryGuid = mySession.GuidValue Then  
            Console.WriteLine("Item category: Folder") 
            found = True 
         End If 
      End If 
 
      If found = False Then 
         WiaSession.GetCategoryGuid(WiaCategories.Root) 
         If wiaSession.CategoryGuid = mySession.GuidValue Then  
            Console.WriteLine("Item category: Root") 
            found = True 
         End If 
      End If 
 
      session.FreeItem(e.Item) 
   End If 
End Sub | 
 
| C# |  Copy Code | 
|---|
WiaSession mySession;  public void GetPropertyGuidExample(IWin32Window 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;     }       mySession.GetRootItem(null);     if (mySession.RootItem != null)     {        mySession.EnumItemsEvent += new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent3);          mySession.EnumChildItems(mySession.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).        mySession.GetPropertyGuid(e.Item, null, WiaPropertyId.ItemCategory);          // Find the related item category for the received Guid.        WiaSession.GetCategoryGuid(WiaCategories.Feeder);        if (WiaSession.CategoryGuid == mySession.GuidValue)   // the item is a Feeder.        {           Console.WriteLine("Item category: Feeder");           found = true;        }          if (found == false)        {           WiaSession.GetCategoryGuid(WiaCategories.FeederBack);           if (WiaSession.CategoryGuid == mySession.GuidValue)   // the item is a Feeder.           {              Console.WriteLine("Item category: FeederBack");              found = true;           }        }          if (found == false)        {           WiaSession.GetCategoryGuid(WiaCategories.FeederFront);           if (WiaSession.CategoryGuid == mySession.GuidValue)   // the item is a Feeder.           {              Console.WriteLine("Item category: FeederFront");              found = true;           }        }          if (found == false)        {           WiaSession.GetCategoryGuid(WiaCategories.Film);           if (WiaSession.CategoryGuid == mySession.GuidValue)   // the item is a Feeder.           {              Console.WriteLine("Item category: Film");              found = true;           }        }          if (found == false)        {           WiaSession.GetCategoryGuid(WiaCategories.FinishedFile);           if (WiaSession.CategoryGuid == mySession.GuidValue)   // the item is a Feeder.           {              Console.WriteLine("Item category: FinishedFile");              found = true;           }        }          if (found == false)        {           WiaSession.GetCategoryGuid(WiaCategories.Flatbed);           if (WiaSession.CategoryGuid == mySession.GuidValue)   // the item is a Feeder.           {              Console.WriteLine("Item category: Flatbed");              found = true;           }        }          if (found == false)        {           WiaSession.GetCategoryGuid(WiaCategories.Folder);           if (WiaSession.CategoryGuid == mySession.GuidValue)   // the item is a Feeder.           {              Console.WriteLine("Item category: Folder");              found = true;           }        }          if (found == false)        {           WiaSession.GetCategoryGuid(WiaCategories.Root);           if (WiaSession.CategoryGuid == mySession.GuidValue)   // the item is a Feeder.           {              Console.WriteLine("Item category: Root");              found = true;           }        }          mySession.FreeItem(e.Item);     }  } | 
 
  
            
            Remarks
            
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows 2000, Windows XP, Windows Vista, Windows Server 2003 family, Windows Server 2008 family
 
            
            
See Also