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

SCANWINDOW

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

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

フィールド

フィールドサイズx64x86説明
xPosINT4+0+0スキャン領域の左上隅のX座標を表す。
yPosINT4+4+4スキャン領域の左上隅のY座標を表す。
xExtentINT4+8+8スキャン領域の横幅を表す。
yExtentINT4+12+12スキャン領域の縦の高さを表す。

各言語での定義

#include <windows.h>

// SCANWINDOW  (x64 16 / x86 16 バイト)
typedef struct SCANWINDOW {
    INT xPos;
    INT yPos;
    INT xExtent;
    INT yExtent;
} SCANWINDOW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SCANWINDOW
{
    public int xPos;
    public int yPos;
    public int xExtent;
    public int yExtent;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SCANWINDOW
    Public xPos As Integer
    Public yPos As Integer
    Public xExtent As Integer
    Public yExtent As Integer
End Structure
import ctypes
from ctypes import wintypes

class SCANWINDOW(ctypes.Structure):
    _fields_ = [
        ("xPos", ctypes.c_int),
        ("yPos", ctypes.c_int),
        ("xExtent", ctypes.c_int),
        ("yExtent", ctypes.c_int),
    ]
#[repr(C)]
pub struct SCANWINDOW {
    pub xPos: i32,
    pub yPos: i32,
    pub xExtent: i32,
    pub yExtent: i32,
}
import "golang.org/x/sys/windows"

type SCANWINDOW struct {
	xPos int32
	yPos int32
	xExtent int32
	yExtent int32
}
type
  SCANWINDOW = record
    xPos: Integer;
    yPos: Integer;
    xExtent: Integer;
    yExtent: Integer;
  end;
const SCANWINDOW = extern struct {
    xPos: i32,
    yPos: i32,
    xExtent: i32,
    yExtent: i32,
};
type
  SCANWINDOW {.bycopy.} = object
    xPos: int32
    yPos: int32
    xExtent: int32
    yExtent: int32
struct SCANWINDOW
{
    int xPos;
    int yPos;
    int xExtent;
    int yExtent;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SCANWINDOW サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; xPos : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; yPos : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; xExtent : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; yExtent : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SCANWINDOW
    #field int xPos
    #field int yPos
    #field int xExtent
    #field int yExtent
#endstruct

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