ホーム › Devices.Usb › USB_PORT_EXT_STATUS_AND_CHANGE
USB_PORT_EXT_STATUS_AND_CHANGE
共用体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| AsUlong64 | ULONGLONG | 8 | +0 | +0 | ポート拡張ステータスと変化を64ビット生値として参照するメンバ。 |
| Anonymous | _Anonymous_e__Struct | 8 | +0 | +0 | ポート変化情報と拡張ステータスを持つ無名構造体。 |
構造体: _Anonymous_e__Struct x64 8B / x86 8B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| PortStatusChange | USB_PORT_STATUS_AND_CHANGE | 4 | +0 | +0 |
| PortExtStatus | USB_PORT_EXT_STATUS | 4 | +4 | +4 |
各言語での定義
#include <windows.h>
// USB_PORT_EXT_STATUS_AND_CHANGE (x64 8 / x86 8 バイト)
#pragma pack(push, 1)
typedef struct USB_PORT_EXT_STATUS_AND_CHANGE {
ULONGLONG AsUlong64;
_Anonymous_e__Struct Anonymous;
} USB_PORT_EXT_STATUS_AND_CHANGE;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB_PORT_EXT_STATUS_AND_CHANGE
{
public ulong AsUlong64;
public _Anonymous_e__Struct Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB_PORT_EXT_STATUS_AND_CHANGE
Public AsUlong64 As ULong
Public Anonymous As _Anonymous_e__Struct
End Structureimport ctypes
from ctypes import wintypes
class USB_PORT_EXT_STATUS_AND_CHANGE(ctypes.Structure):
_pack_ = 1
_fields_ = [
("AsUlong64", ctypes.c_ulonglong),
("Anonymous", _Anonymous_e__Struct),
]#[repr(C, packed(1))]
pub struct USB_PORT_EXT_STATUS_AND_CHANGE {
pub AsUlong64: u64,
pub Anonymous: _Anonymous_e__Struct,
}import "golang.org/x/sys/windows"
type USB_PORT_EXT_STATUS_AND_CHANGE struct {
AsUlong64 uint64
Anonymous _Anonymous_e__Struct
}type
USB_PORT_EXT_STATUS_AND_CHANGE = packed record
AsUlong64: UInt64;
Anonymous: _Anonymous_e__Struct;
end;const USB_PORT_EXT_STATUS_AND_CHANGE = extern struct {
AsUlong64: u64,
Anonymous: _Anonymous_e__Struct,
};type
USB_PORT_EXT_STATUS_AND_CHANGE {.packed.} = object
AsUlong64: uint64
Anonymous: _Anonymous_e__Structalign(1)
struct USB_PORT_EXT_STATUS_AND_CHANGE
{
ulong AsUlong64;
_Anonymous_e__Struct Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USB_PORT_EXT_STATUS_AND_CHANGE サイズ: 8 バイト(x64)
dim st, 2 ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; AsUlong64 : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Anonymous : _Anonymous_e__Struct (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USB_PORT_EXT_STATUS_AND_CHANGE, pack=1
#field int64 AsUlong64
#field _Anonymous_e__Struct Anonymous
#endstruct
stdim st, USB_PORT_EXT_STATUS_AND_CHANGE ; NSTRUCT 変数を確保
st->AsUlong64 = 100
mes "AsUlong64=" + st->AsUlong64