Intellisense/documentation of WIA constants and values

897 Views Asked by At

Looking at the WIA driver documentation for the WIA_IPS_DOCUMENT_HANDLING_SELECT property, the valid values are listed as:

  • BACK_FIRST
  • BACK_ONLY
  • DUPLEX
  • FRONT_FIRST
  • FRONT_ONLY

Just the names, no values.

The documentation of the properties from the application developer's perspective (WIA_IPS_DOCUMENT_HANDLING_SELECT looks the same.

If I want to write the following code, using WIA Automation and VB.NET (could just as easily be in C#):

Dim manager = New DeviceManager
Dim deviceinfo = manager.DeviceInfos.Cast(Of DeviceInfo).First() 'Assuming there is an available device
Dim device = deviceinfo.Connect
device.Properties(WIA_IPS_DOCUMENT_HANDLING_SELECT).Value = FRONT_FIRST

I cannot do so, because these constants are not available from the WIA Automation layer, and therefore not available from Intellisense.

I can define specific constants that I need, or use magic numbers when I know them:

device.Properties(3088).Value = ???

How can I get these constants in Intellisense without defining them myself, or where is there documentation for the values of these constants?

1

There are 1 best solutions below

2
On

You mean like this?

Public Class Const_WIA

    Public Const WIA_RESERVED_FOR_NEW_PROPS As UInt32 = 1024
    Public Const WIA_DIP_FIRST As UInt32 = 2
    Public Const WIA_DPA_FIRST As UInt32 = WIA_DIP_FIRST + WIA_RESERVED_FOR_NEW_PROPS
    Public Const WIA_DPC_FIRST As UInt32 = WIA_DPA_FIRST + WIA_RESERVED_FOR_NEW_PROPS '
    '       //
    '       // Scanner only device properties (DPS)
    '       //
    Public Const WIA_DPS_FIRST As UInt32 = WIA_DPC_FIRST + WIA_RESERVED_FOR_NEW_PROPS
    Public Const WIA_DPS_DOCUMENT_HANDLING_STATUS As UInt32 = WIA_DPS_FIRST + 13
    Public Const WIA_DPS_DOCUMENT_HANDLING_SELECT As UInt32 = WIA_DPS_FIRST + 14
End Class

here's a list with matching values