AUTO_SCROLL_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| iNextSample | INT | 4 | +0 | +0 | 次に記録するサンプルのインデックス。リングバッファ位置を示す。 |
| dwLastScroll | DWORD | 4 | +4 | +4 | 最後にスクロールを実行した時刻(ミリ秒)。 |
| bFull | BOOL | 4 | +8 | +8 | サンプルバッファが満杯かどうかを示す真偽値。TRUE で満杯。 |
| pts | POINT | 24 | +12 | +12 | 記録されたカーソル位置サンプルの配列(POINT)。 |
| dwTimes | DWORD | 12 | +36 | +36 | 各サンプルが記録された時刻の配列(ミリ秒)。 |
各言語での定義
#include <windows.h>
// POINT (x64 8 / x86 8 バイト)
typedef struct POINT {
INT x;
INT y;
} POINT;
// AUTO_SCROLL_DATA (x64 48 / x86 48 バイト)
#pragma pack(push, 1)
typedef struct AUTO_SCROLL_DATA {
INT iNextSample;
DWORD dwLastScroll;
BOOL bFull;
POINT pts[3];
DWORD dwTimes[3];
} AUTO_SCROLL_DATA;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINT
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct AUTO_SCROLL_DATA
{
public int iNextSample;
public uint dwLastScroll;
[MarshalAs(UnmanagedType.Bool)] public bool bFull;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public POINT[] pts;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] dwTimes;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINT
Public x As Integer
Public y As Integer
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure AUTO_SCROLL_DATA
Public iNextSample As Integer
Public dwLastScroll As UInteger
<MarshalAs(UnmanagedType.Bool)> Public bFull As Boolean
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public pts() As POINT
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public dwTimes() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class POINT(ctypes.Structure):
_fields_ = [
("x", ctypes.c_int),
("y", ctypes.c_int),
]
class AUTO_SCROLL_DATA(ctypes.Structure):
_pack_ = 1
_fields_ = [
("iNextSample", ctypes.c_int),
("dwLastScroll", wintypes.DWORD),
("bFull", wintypes.BOOL),
("pts", POINT * 3),
("dwTimes", wintypes.DWORD * 3),
]#[repr(C)]
pub struct POINT {
pub x: i32,
pub y: i32,
}
#[repr(C, packed(1))]
pub struct AUTO_SCROLL_DATA {
pub iNextSample: i32,
pub dwLastScroll: u32,
pub bFull: i32,
pub pts: [POINT; 3],
pub dwTimes: [u32; 3],
}import "golang.org/x/sys/windows"
type POINT struct {
x int32
y int32
}
type AUTO_SCROLL_DATA struct {
iNextSample int32
dwLastScroll uint32
bFull int32
pts [3]POINT
dwTimes [3]uint32
}type
POINT = record
x: Integer;
y: Integer;
end;
AUTO_SCROLL_DATA = packed record
iNextSample: Integer;
dwLastScroll: DWORD;
bFull: BOOL;
pts: array[0..2] of POINT;
dwTimes: array[0..2] of DWORD;
end;const POINT = extern struct {
x: i32,
y: i32,
};
const AUTO_SCROLL_DATA = extern struct {
iNextSample: i32,
dwLastScroll: u32,
bFull: i32,
pts: [3]POINT,
dwTimes: [3]u32,
};type
POINT {.bycopy.} = object
x: int32
y: int32
AUTO_SCROLL_DATA {.packed.} = object
iNextSample: int32
dwLastScroll: uint32
bFull: int32
pts: array[3, POINT]
dwTimes: array[3, uint32]struct POINT
{
int x;
int y;
}
align(1)
struct AUTO_SCROLL_DATA
{
int iNextSample;
uint dwLastScroll;
int bFull;
POINT[3] pts;
uint[3] dwTimes;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; AUTO_SCROLL_DATA サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; iNextSample : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwLastScroll : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; bFull : BOOL (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; pts : POINT (+12, 24byte) varptr(st)+12 を基点に操作(24byte:入れ子/配列)
; dwTimes : DWORD (+36, 12byte) varptr(st)+36 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global POINT
#field int x
#field int y
#endstruct
#defstruct global AUTO_SCROLL_DATA, pack=1
#field int iNextSample
#field int dwLastScroll
#field bool bFull
#field POINT pts 3
#field int dwTimes 3
#endstruct
stdim st, AUTO_SCROLL_DATA ; NSTRUCT 変数を確保
st->iNextSample = 100
mes "iNextSample=" + st->iNextSample