ホーム › Devices.ImageAcquisition › WIA_MICR
WIA_MICR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Tag | DWORD | 4 | +0 | +0 | MICRデータを識別するタグ値。 |
| Version | DWORD | 4 | +4 | +4 | 構造体のバージョン番号。 |
| Size | DWORD | 4 | +8 | +8 | この構造体全体のバイトサイズ。 |
| Placeholder | WCHAR | 2 | +12 | +12 | 認識不能文字を表すプレースホルダー文字。 |
| Reserved | WORD | 2 | +14 | +14 | 予約フィールド。使用しない。 |
| Count | DWORD | 4 | +16 | +16 | Micr配列に含まれるMICR情報の数。 |
| Micr | WIA_MICR_INFO | 16 | +20 | +20 | 読み取ったMICR情報(WIA_MICR_INFO)の配列。 |
各言語での定義
#include <windows.h>
// WIA_MICR_INFO (x64 16 / x86 16 バイト)
typedef struct WIA_MICR_INFO {
DWORD Size;
DWORD Page;
DWORD Length;
WCHAR Text[1];
} WIA_MICR_INFO;
// WIA_MICR (x64 36 / x86 36 バイト)
typedef struct WIA_MICR {
DWORD Tag;
DWORD Version;
DWORD Size;
WCHAR Placeholder;
WORD Reserved;
DWORD Count;
WIA_MICR_INFO Micr[1];
} WIA_MICR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WIA_MICR_INFO
{
public uint Size;
public uint Page;
public uint Length;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string Text;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WIA_MICR
{
public uint Tag;
public uint Version;
public uint Size;
public char Placeholder;
public ushort Reserved;
public uint Count;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WIA_MICR_INFO[] Micr;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WIA_MICR_INFO
Public Size As UInteger
Public Page As UInteger
Public Length As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public Text As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WIA_MICR
Public Tag As UInteger
Public Version As UInteger
Public Size As UInteger
Public Placeholder As Char
Public Reserved As UShort
Public Count As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Micr() As WIA_MICR_INFO
End Structureimport ctypes
from ctypes import wintypes
class WIA_MICR_INFO(ctypes.Structure):
_fields_ = [
("Size", wintypes.DWORD),
("Page", wintypes.DWORD),
("Length", wintypes.DWORD),
("Text", ctypes.c_wchar * 1),
]
class WIA_MICR(ctypes.Structure):
_fields_ = [
("Tag", wintypes.DWORD),
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("Placeholder", ctypes.c_wchar),
("Reserved", ctypes.c_ushort),
("Count", wintypes.DWORD),
("Micr", WIA_MICR_INFO * 1),
]#[repr(C)]
pub struct WIA_MICR_INFO {
pub Size: u32,
pub Page: u32,
pub Length: u32,
pub Text: [u16; 1],
}
#[repr(C)]
pub struct WIA_MICR {
pub Tag: u32,
pub Version: u32,
pub Size: u32,
pub Placeholder: u16,
pub Reserved: u16,
pub Count: u32,
pub Micr: [WIA_MICR_INFO; 1],
}import "golang.org/x/sys/windows"
type WIA_MICR_INFO struct {
Size uint32
Page uint32
Length uint32
Text [1]uint16
}
type WIA_MICR struct {
Tag uint32
Version uint32
Size uint32
Placeholder uint16
Reserved uint16
Count uint32
Micr [1]WIA_MICR_INFO
}type
WIA_MICR_INFO = record
Size: DWORD;
Page: DWORD;
Length: DWORD;
Text: array[0..0] of WideChar;
end;
WIA_MICR = record
Tag: DWORD;
Version: DWORD;
Size: DWORD;
Placeholder: WideChar;
Reserved: Word;
Count: DWORD;
Micr: array[0..0] of WIA_MICR_INFO;
end;const WIA_MICR_INFO = extern struct {
Size: u32,
Page: u32,
Length: u32,
Text: [1]u16,
};
const WIA_MICR = extern struct {
Tag: u32,
Version: u32,
Size: u32,
Placeholder: u16,
Reserved: u16,
Count: u32,
Micr: [1]WIA_MICR_INFO,
};type
WIA_MICR_INFO {.bycopy.} = object
Size: uint32
Page: uint32
Length: uint32
Text: array[1, uint16]
WIA_MICR {.bycopy.} = object
Tag: uint32
Version: uint32
Size: uint32
Placeholder: uint16
Reserved: uint16
Count: uint32
Micr: array[1, WIA_MICR_INFO]struct WIA_MICR_INFO
{
uint Size;
uint Page;
uint Length;
wchar[1] Text;
}
struct WIA_MICR
{
uint Tag;
uint Version;
uint Size;
wchar Placeholder;
ushort Reserved;
uint Count;
WIA_MICR_INFO[1] Micr;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WIA_MICR サイズ: 36 バイト(x64)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; Tag : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Version : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Size : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Placeholder : WCHAR (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; Reserved : WORD (+14, 2byte) wpoke st,14,値 / 値 = wpeek(st,14)
; Count : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Micr : WIA_MICR_INFO (+20, 16byte) varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WIA_MICR_INFO
#field int Size
#field int Page
#field int Length
#field wchar Text 1
#endstruct
#defstruct global WIA_MICR
#field int Tag
#field int Version
#field int Size
#field short Placeholder
#field short Reserved
#field int Count
#field WIA_MICR_INFO Micr 1
#endstruct
stdim st, WIA_MICR ; NSTRUCT 変数を確保
st->Tag = 100
mes "Tag=" + st->Tag