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

WIA_BARCODE_INFO

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

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

フィールド

フィールドサイズx64x86説明
SizeDWORD4+0+0この構造体のバイトサイズ。
TypeDWORD4+4+4検出されたバーコードの種類を示す値。
PageDWORD4+8+8バーコードが存在するページ番号。
ConfidenceDWORD4+12+12認識の信頼度(0〜100程度)。
XOffsetDWORD4+16+16バーコードのX方向位置(オフセット)。
YOffsetDWORD4+20+20バーコードのY方向位置(オフセット)。
RotationDWORD4+24+24バーコードの回転角度を示す値。
LengthDWORD4+28+28Textフィールドの文字数。
TextWCHAR2+32+32バーコードから読み取った文字列を示すワイド文字列。

各言語での定義

#include <windows.h>

// WIA_BARCODE_INFO  (x64 36 / x86 36 バイト)
typedef struct WIA_BARCODE_INFO {
    DWORD Size;
    DWORD Type;
    DWORD Page;
    DWORD Confidence;
    DWORD XOffset;
    DWORD YOffset;
    DWORD Rotation;
    DWORD Length;
    WCHAR Text[1];
} WIA_BARCODE_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WIA_BARCODE_INFO
{
    public uint Size;
    public uint Type;
    public uint Page;
    public uint Confidence;
    public uint XOffset;
    public uint YOffset;
    public uint Rotation;
    public uint Length;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string Text;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WIA_BARCODE_INFO
    Public Size As UInteger
    Public Type As UInteger
    Public Page As UInteger
    Public Confidence As UInteger
    Public XOffset As UInteger
    Public YOffset As UInteger
    Public Rotation 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_BARCODE_INFO(ctypes.Structure):
    _fields_ = [
        ("Size", wintypes.DWORD),
        ("Type", wintypes.DWORD),
        ("Page", wintypes.DWORD),
        ("Confidence", wintypes.DWORD),
        ("XOffset", wintypes.DWORD),
        ("YOffset", wintypes.DWORD),
        ("Rotation", wintypes.DWORD),
        ("Length", wintypes.DWORD),
        ("Text", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct WIA_BARCODE_INFO {
    pub Size: u32,
    pub Type: u32,
    pub Page: u32,
    pub Confidence: u32,
    pub XOffset: u32,
    pub YOffset: u32,
    pub Rotation: u32,
    pub Length: u32,
    pub Text: [u16; 1],
}
import "golang.org/x/sys/windows"

type WIA_BARCODE_INFO struct {
	Size uint32
	Type uint32
	Page uint32
	Confidence uint32
	XOffset uint32
	YOffset uint32
	Rotation uint32
	Length uint32
	Text [1]uint16
}
type
  WIA_BARCODE_INFO = record
    Size: DWORD;
    Type: DWORD;
    Page: DWORD;
    Confidence: DWORD;
    XOffset: DWORD;
    YOffset: DWORD;
    Rotation: DWORD;
    Length: DWORD;
    Text: array[0..0] of WideChar;
  end;
const WIA_BARCODE_INFO = extern struct {
    Size: u32,
    Type: u32,
    Page: u32,
    Confidence: u32,
    XOffset: u32,
    YOffset: u32,
    Rotation: u32,
    Length: u32,
    Text: [1]u16,
};
type
  WIA_BARCODE_INFO {.bycopy.} = object
    Size: uint32
    Type: uint32
    Page: uint32
    Confidence: uint32
    XOffset: uint32
    YOffset: uint32
    Rotation: uint32
    Length: uint32
    Text: array[1, uint16]
struct WIA_BARCODE_INFO
{
    uint Size;
    uint Type;
    uint Page;
    uint Confidence;
    uint XOffset;
    uint YOffset;
    uint Rotation;
    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_BARCODE_INFO サイズ: 36 バイト(x64)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; Size : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Type : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Page : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Confidence : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; XOffset : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; YOffset : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Rotation : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Length : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; Text : WCHAR (+32, 2byte)  varptr(st)+32 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WIA_BARCODE_INFO
    #field int Size
    #field int Type
    #field int Page
    #field int Confidence
    #field int XOffset
    #field int YOffset
    #field int Rotation
    #field int Length
    #field wchar Text 1
#endstruct

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