ホーム › UI.Controls › MEASUREITEMSTRUCT
MEASUREITEMSTRUCT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| CtlType | DRAWITEMSTRUCT_CTL_TYPE | 4 | +0 | +0 | コントロールの種類(DRAWITEMSTRUCT_CTL_TYPE、ODT_*)。 |
| CtlID | DWORD | 4 | +4 | +4 | コントロールの識別子。メニューでは0。 |
| itemID | DWORD | 4 | +8 | +8 | 計測対象項目のインデックス。 |
| itemWidth | DWORD | 4 | +12 | +12 | アプリが返す項目の幅(ピクセル)。 |
| itemHeight | DWORD | 4 | +16 | +16 | アプリが返す項目の高さ(ピクセル)。 |
| itemData | UINT_PTR | 8/4 | +24 | +20 | 項目に関連付けられたアプリケーション定義値。 |
各言語での定義
#include <windows.h>
// MEASUREITEMSTRUCT (x64 32 / x86 24 バイト)
typedef struct MEASUREITEMSTRUCT {
DRAWITEMSTRUCT_CTL_TYPE CtlType;
DWORD CtlID;
DWORD itemID;
DWORD itemWidth;
DWORD itemHeight;
UINT_PTR itemData;
} MEASUREITEMSTRUCT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MEASUREITEMSTRUCT
{
public uint CtlType;
public uint CtlID;
public uint itemID;
public uint itemWidth;
public uint itemHeight;
public UIntPtr itemData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MEASUREITEMSTRUCT
Public CtlType As UInteger
Public CtlID As UInteger
Public itemID As UInteger
Public itemWidth As UInteger
Public itemHeight As UInteger
Public itemData As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class MEASUREITEMSTRUCT(ctypes.Structure):
_fields_ = [
("CtlType", wintypes.DWORD),
("CtlID", wintypes.DWORD),
("itemID", wintypes.DWORD),
("itemWidth", wintypes.DWORD),
("itemHeight", wintypes.DWORD),
("itemData", ctypes.c_size_t),
]#[repr(C)]
pub struct MEASUREITEMSTRUCT {
pub CtlType: u32,
pub CtlID: u32,
pub itemID: u32,
pub itemWidth: u32,
pub itemHeight: u32,
pub itemData: usize,
}import "golang.org/x/sys/windows"
type MEASUREITEMSTRUCT struct {
CtlType uint32
CtlID uint32
itemID uint32
itemWidth uint32
itemHeight uint32
itemData uintptr
}type
MEASUREITEMSTRUCT = record
CtlType: DWORD;
CtlID: DWORD;
itemID: DWORD;
itemWidth: DWORD;
itemHeight: DWORD;
itemData: NativeUInt;
end;const MEASUREITEMSTRUCT = extern struct {
CtlType: u32,
CtlID: u32,
itemID: u32,
itemWidth: u32,
itemHeight: u32,
itemData: usize,
};type
MEASUREITEMSTRUCT {.bycopy.} = object
CtlType: uint32
CtlID: uint32
itemID: uint32
itemWidth: uint32
itemHeight: uint32
itemData: uintstruct MEASUREITEMSTRUCT
{
uint CtlType;
uint CtlID;
uint itemID;
uint itemWidth;
uint itemHeight;
size_t itemData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MEASUREITEMSTRUCT サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; CtlType : DRAWITEMSTRUCT_CTL_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; CtlID : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; itemID : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; itemWidth : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; itemHeight : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; itemData : UINT_PTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MEASUREITEMSTRUCT サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; CtlType : DRAWITEMSTRUCT_CTL_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; CtlID : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; itemID : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; itemWidth : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; itemHeight : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; itemData : UINT_PTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MEASUREITEMSTRUCT
#field int CtlType
#field int CtlID
#field int itemID
#field int itemWidth
#field int itemHeight
#field intptr itemData
#endstruct
stdim st, MEASUREITEMSTRUCT ; NSTRUCT 変数を確保
st->CtlType = 100
mes "CtlType=" + st->CtlType