Tattakashi123 / t

Automatically exported from code.google.com/p/twaindotnet
0 stars 0 forks source link

Capability Enum and Array values #23

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Any plan to add function for getting Capability Enum and Array values; You 
already have classes like CapabilityEnumValue.cs; however Diagnostics.cs only 
returns (OneValue)

Using bare twain api in C#; 
I have, 

  [StructLayout(LayoutKind.Sequential, Pack = 2)]
        struct TwEnum
        { 
            public UInt16 ItemType;
            public UInt16 NumItems;     /* How many items in ItemList                 */
            public UInt32 CurrentIndex; /* Current value is in ItemList[CurrentIndex] */
            public UInt32 DefaultIndex; /* Powerup value is in ItemList[DefaultIndex] */
            [MarshalAs(UnmanagedType.ByValArray, SizeConst=10)]
            public int[] ItemList;               
        } 

Using this I could get all the supported DPI (ICAP_XRESOLUTION) in ItemList
However I don't like using SizeConst= 10 or whatever. 

The Twain c++ demo or your C# definition of EnumValue uses a byte for the First 
element in the array; I guess this approach is good as you don't need to 
hardcode the Returned array length.

Original issue reported on code.google.com by webmaste...@gtempaccount.com on 12 Aug 2010 at 7:47