ホーム › UI.Controls › TVITEMEXA
TVITEMEXA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| mask | TVITEM_MASK | 4 | +0 | +0 | 有効なメンバーを示すマスクフラグ(TVITEM_MASK、TVIF_*)。 |
| hItem | HTREEITEM | 8/4 | +8 | +4 | 対象ツリービュー項目のハンドル。 |
| state | DWORD | 4 | +16 | +8 | 項目の状態フラグ(選択・展開・チェックなど)。 |
| stateMask | DWORD | 4 | +20 | +12 | stateのうち有効なビットを示すマスク。 |
| pszText | LPSTR | 8/4 | +24 | +16 | 項目テキストのバッファ(ANSI)。取得時はバッファ、設定時は文字列を指す。 |
| cchTextMax | INT | 4 | +32 | +20 | pszTextバッファの最大文字数。取得時のみ有効。 |
| iImage | INT | 4 | +36 | +24 | 通常状態のアイコンのイメージリストインデックス。 |
| iSelectedImage | INT | 4 | +40 | +28 | 選択状態のアイコンのイメージリストインデックス。 |
| cChildren | TVITEMEXW_CHILDREN | 4 | +44 | +32 | 子項目数を示す値。子有無の指定に特殊値も使用。 |
| lParam | LPARAM | 8/4 | +48 | +36 | 項目に関連付けるアプリケーション定義値。 |
| iIntegral | INT | 4 | +56 | +40 | 項目の高さを基準項目高さの整数倍で指定する値。 |
| uStateEx | DWORD | 4 | +60 | +44 | 拡張状態フラグ(TVIS_EX_*、無効化やフラットなど)。 |
| hwnd | HWND | 8/4 | +64 | +48 | 項目に関連付けられたウィンドウのハンドル。 |
| iExpandedImage | INT | 4 | +72 | +52 | 展開状態のアイコンのイメージリストインデックス。 |
| iReserved | INT | 4 | +76 | +56 | 予約済み。使用しない。 |
各言語での定義
#include <windows.h>
// TVITEMEXA (x64 80 / x86 60 バイト)
typedef struct TVITEMEXA {
TVITEM_MASK mask;
HTREEITEM hItem;
DWORD state;
DWORD stateMask;
LPSTR pszText;
INT cchTextMax;
INT iImage;
INT iSelectedImage;
TVITEMEXW_CHILDREN cChildren;
LPARAM lParam;
INT iIntegral;
DWORD uStateEx;
HWND hwnd;
INT iExpandedImage;
INT iReserved;
} TVITEMEXA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TVITEMEXA
{
public uint mask;
public IntPtr hItem;
public uint state;
public uint stateMask;
public IntPtr pszText;
public int cchTextMax;
public int iImage;
public int iSelectedImage;
public int cChildren;
public IntPtr lParam;
public int iIntegral;
public uint uStateEx;
public IntPtr hwnd;
public int iExpandedImage;
public int iReserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TVITEMEXA
Public mask As UInteger
Public hItem As IntPtr
Public state As UInteger
Public stateMask As UInteger
Public pszText As IntPtr
Public cchTextMax As Integer
Public iImage As Integer
Public iSelectedImage As Integer
Public cChildren As Integer
Public lParam As IntPtr
Public iIntegral As Integer
Public uStateEx As UInteger
Public hwnd As IntPtr
Public iExpandedImage As Integer
Public iReserved As Integer
End Structureimport ctypes
from ctypes import wintypes
class TVITEMEXA(ctypes.Structure):
_fields_ = [
("mask", wintypes.DWORD),
("hItem", ctypes.c_ssize_t),
("state", wintypes.DWORD),
("stateMask", wintypes.DWORD),
("pszText", ctypes.c_void_p),
("cchTextMax", ctypes.c_int),
("iImage", ctypes.c_int),
("iSelectedImage", ctypes.c_int),
("cChildren", ctypes.c_int),
("lParam", ctypes.c_ssize_t),
("iIntegral", ctypes.c_int),
("uStateEx", wintypes.DWORD),
("hwnd", ctypes.c_void_p),
("iExpandedImage", ctypes.c_int),
("iReserved", ctypes.c_int),
]#[repr(C)]
pub struct TVITEMEXA {
pub mask: u32,
pub hItem: isize,
pub state: u32,
pub stateMask: u32,
pub pszText: *mut core::ffi::c_void,
pub cchTextMax: i32,
pub iImage: i32,
pub iSelectedImage: i32,
pub cChildren: i32,
pub lParam: isize,
pub iIntegral: i32,
pub uStateEx: u32,
pub hwnd: *mut core::ffi::c_void,
pub iExpandedImage: i32,
pub iReserved: i32,
}import "golang.org/x/sys/windows"
type TVITEMEXA struct {
mask uint32
hItem uintptr
state uint32
stateMask uint32
pszText uintptr
cchTextMax int32
iImage int32
iSelectedImage int32
cChildren int32
lParam uintptr
iIntegral int32
uStateEx uint32
hwnd uintptr
iExpandedImage int32
iReserved int32
}type
TVITEMEXA = record
mask: DWORD;
hItem: NativeInt;
state: DWORD;
stateMask: DWORD;
pszText: Pointer;
cchTextMax: Integer;
iImage: Integer;
iSelectedImage: Integer;
cChildren: Integer;
lParam: NativeInt;
iIntegral: Integer;
uStateEx: DWORD;
hwnd: Pointer;
iExpandedImage: Integer;
iReserved: Integer;
end;const TVITEMEXA = extern struct {
mask: u32,
hItem: isize,
state: u32,
stateMask: u32,
pszText: ?*anyopaque,
cchTextMax: i32,
iImage: i32,
iSelectedImage: i32,
cChildren: i32,
lParam: isize,
iIntegral: i32,
uStateEx: u32,
hwnd: ?*anyopaque,
iExpandedImage: i32,
iReserved: i32,
};type
TVITEMEXA {.bycopy.} = object
mask: uint32
hItem: int
state: uint32
stateMask: uint32
pszText: pointer
cchTextMax: int32
iImage: int32
iSelectedImage: int32
cChildren: int32
lParam: int
iIntegral: int32
uStateEx: uint32
hwnd: pointer
iExpandedImage: int32
iReserved: int32struct TVITEMEXA
{
uint mask;
ptrdiff_t hItem;
uint state;
uint stateMask;
void* pszText;
int cchTextMax;
int iImage;
int iSelectedImage;
int cChildren;
ptrdiff_t lParam;
int iIntegral;
uint uStateEx;
void* hwnd;
int iExpandedImage;
int iReserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; TVITEMEXA サイズ: 60 バイト(x86)
dim st, 15 ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; mask : TVITEM_MASK (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hItem : HTREEITEM (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; state : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; stateMask : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; pszText : LPSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cchTextMax : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; iImage : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; iSelectedImage : INT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; cChildren : TVITEMEXW_CHILDREN (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; lParam : LPARAM (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; iIntegral : INT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; uStateEx : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; hwnd : HWND (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; iExpandedImage : INT (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; iReserved : INT (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TVITEMEXA サイズ: 80 バイト(x64)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; mask : TVITEM_MASK (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hItem : HTREEITEM (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; state : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; stateMask : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pszText : LPSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; cchTextMax : INT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; iImage : INT (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; iSelectedImage : INT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; cChildren : TVITEMEXW_CHILDREN (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; lParam : LPARAM (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; iIntegral : INT (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; uStateEx : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; hwnd : HWND (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; iExpandedImage : INT (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; iReserved : INT (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TVITEMEXA
#field int mask
#field intptr hItem
#field int state
#field int stateMask
#field intptr pszText
#field int cchTextMax
#field int iImage
#field int iSelectedImage
#field int cChildren
#field intptr lParam
#field int iIntegral
#field int uStateEx
#field intptr hwnd
#field int iExpandedImage
#field int iReserved
#endstruct
stdim st, TVITEMEXA ; NSTRUCT 変数を確保
st->mask = 100
mes "mask=" + st->mask