ITEMSPACING
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cxSmall | INT | 4 | +0 | +0 | 小アイコン表示時の水平方向の項目間隔(ピクセル)。 |
| cySmall | INT | 4 | +4 | +4 | 小アイコン表示時の垂直方向の項目間隔(ピクセル)。 |
| cxLarge | INT | 4 | +8 | +8 | 大アイコン表示時の水平方向の項目間隔(ピクセル)。 |
| cyLarge | INT | 4 | +12 | +12 | 大アイコン表示時の垂直方向の項目間隔(ピクセル)。 |
各言語での定義
#include <windows.h>
// ITEMSPACING (x64 16 / x86 16 バイト)
typedef struct ITEMSPACING {
INT cxSmall;
INT cySmall;
INT cxLarge;
INT cyLarge;
} ITEMSPACING;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ITEMSPACING
{
public int cxSmall;
public int cySmall;
public int cxLarge;
public int cyLarge;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ITEMSPACING
Public cxSmall As Integer
Public cySmall As Integer
Public cxLarge As Integer
Public cyLarge As Integer
End Structureimport ctypes
from ctypes import wintypes
class ITEMSPACING(ctypes.Structure):
_fields_ = [
("cxSmall", ctypes.c_int),
("cySmall", ctypes.c_int),
("cxLarge", ctypes.c_int),
("cyLarge", ctypes.c_int),
]#[repr(C)]
pub struct ITEMSPACING {
pub cxSmall: i32,
pub cySmall: i32,
pub cxLarge: i32,
pub cyLarge: i32,
}import "golang.org/x/sys/windows"
type ITEMSPACING struct {
cxSmall int32
cySmall int32
cxLarge int32
cyLarge int32
}type
ITEMSPACING = record
cxSmall: Integer;
cySmall: Integer;
cxLarge: Integer;
cyLarge: Integer;
end;const ITEMSPACING = extern struct {
cxSmall: i32,
cySmall: i32,
cxLarge: i32,
cyLarge: i32,
};type
ITEMSPACING {.bycopy.} = object
cxSmall: int32
cySmall: int32
cxLarge: int32
cyLarge: int32struct ITEMSPACING
{
int cxSmall;
int cySmall;
int cxLarge;
int cyLarge;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ITEMSPACING サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; cxSmall : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cySmall : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cxLarge : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cyLarge : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ITEMSPACING
#field int cxSmall
#field int cySmall
#field int cxLarge
#field int cyLarge
#endstruct
stdim st, ITEMSPACING ; NSTRUCT 変数を確保
st->cxSmall = 100
mes "cxSmall=" + st->cxSmall