Win32 API 日本語リファレンス
ホームDevices.ImageAcquisition › WIA_MICR_INFO

WIA_MICR_INFO

構造体
サイズx64: 16 バイト / x86: 16 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
SizeDWORD4+0+0この構造体のバイトサイズ。
PageDWORD4+4+4MICRが存在するページ番号。
LengthDWORD4+8+8Textフィールドの文字数。
TextWCHAR2+12+12読み取ったMICR(磁気インク文字)文字列を示すワイド文字列。

各言語での定義

#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;
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;
}
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
import 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),
    ]
#[repr(C)]
pub struct WIA_MICR_INFO {
    pub Size: u32,
    pub Page: u32,
    pub Length: u32,
    pub Text: [u16; 1],
}
import "golang.org/x/sys/windows"

type WIA_MICR_INFO struct {
	Size uint32
	Page uint32
	Length uint32
	Text [1]uint16
}
type
  WIA_MICR_INFO = record
    Size: DWORD;
    Page: DWORD;
    Length: DWORD;
    Text: array[0..0] of WideChar;
  end;
const WIA_MICR_INFO = extern struct {
    Size: u32,
    Page: u32,
    Length: u32,
    Text: [1]u16,
};
type
  WIA_MICR_INFO {.bycopy.} = object
    Size: uint32
    Page: uint32
    Length: uint32
    Text: array[1, uint16]
struct WIA_MICR_INFO
{
    uint Size;
    uint Page;
    uint Length;
    wchar[1] Text;
}

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_INFO サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Size : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Page : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Length : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Text : WCHAR (+12, 2byte)  varptr(st)+12 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WIA_MICR_INFO
    #field int Size
    #field int Page
    #field int Length
    #field wchar Text 1
#endstruct

stdim st, WIA_MICR_INFO        ; NSTRUCT 変数を確保
st->Size = 100
mes "Size=" + st->Size