ホーム › Graphics.Printing › USERDATA
USERDATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で指定する。 |
| dwItemID | UINT_PTR | 8/4 | +8 | +4 | ユーザー項目を識別するID。 |
| pKeyWordName | LPSTR | 8/4 | +16 | +8 | 項目を識別するキーワード名を指すANSI文字列。 |
| dwReserved | DWORD | 32 | +24 | +12 | 予約フィールド。0に設定する。 |
各言語での定義
#include <windows.h>
// USERDATA (x64 56 / x86 44 バイト)
typedef struct USERDATA {
DWORD dwSize;
UINT_PTR dwItemID;
LPSTR pKeyWordName;
DWORD dwReserved[8];
} USERDATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USERDATA
{
public uint dwSize;
public UIntPtr dwItemID;
public IntPtr pKeyWordName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] dwReserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USERDATA
Public dwSize As UInteger
Public dwItemID As UIntPtr
Public pKeyWordName As IntPtr
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public dwReserved() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class USERDATA(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("dwItemID", ctypes.c_size_t),
("pKeyWordName", ctypes.c_void_p),
("dwReserved", wintypes.DWORD * 8),
]#[repr(C)]
pub struct USERDATA {
pub dwSize: u32,
pub dwItemID: usize,
pub pKeyWordName: *mut core::ffi::c_void,
pub dwReserved: [u32; 8],
}import "golang.org/x/sys/windows"
type USERDATA struct {
dwSize uint32
dwItemID uintptr
pKeyWordName uintptr
dwReserved [8]uint32
}type
USERDATA = record
dwSize: DWORD;
dwItemID: NativeUInt;
pKeyWordName: Pointer;
dwReserved: array[0..7] of DWORD;
end;const USERDATA = extern struct {
dwSize: u32,
dwItemID: usize,
pKeyWordName: ?*anyopaque,
dwReserved: [8]u32,
};type
USERDATA {.bycopy.} = object
dwSize: uint32
dwItemID: uint
pKeyWordName: pointer
dwReserved: array[8, uint32]struct USERDATA
{
uint dwSize;
size_t dwItemID;
void* pKeyWordName;
uint[8] dwReserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; USERDATA サイズ: 44 バイト(x86)
dim st, 11 ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwItemID : UINT_PTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pKeyWordName : LPSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwReserved : DWORD (+12, 32byte) varptr(st)+12 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USERDATA サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwItemID : UINT_PTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pKeyWordName : LPSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwReserved : DWORD (+24, 32byte) varptr(st)+24 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USERDATA
#field int dwSize
#field intptr dwItemID
#field intptr pKeyWordName
#field int dwReserved 8
#endstruct
stdim st, USERDATA ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize