Win32 API 日本語リファレンス
ホームUI.Controls › LVCOLUMNA

LVCOLUMNA

構造体
サイズx64: 56 バイト / x86: 44 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
maskLVCOLUMNW_MASK4+0+0有効なメンバーを示すLVCF_系マスクフラグの組み合わせ。
fmtLVCOLUMNW_FORMAT4+4+4列の配置や画像表示を示すLVCFMT_系フラグ。
cxINT4+8+8列の幅(ピクセル)。
pszTextLPSTR8/4+16+12列ヘッダのテキストを保持するバッファへのポインタ。
cchTextMaxINT4+24+16pszTextバッファの最大文字数。
iSubItemINT4+28+20この列に対応するサブ項目のインデックス。
iImageINT4+32+24列ヘッダに表示するイメージのインデックス。
iOrderINT4+36+28列の左から数えた表示順序。0始まり。
cxMinINT4+40+32列の最小幅(ピクセル)。
cxDefaultINT4+44+36列の既定幅(ピクセル)。
cxIdealINT4+48+40コンテンツに合う理想幅(ピクセル)。

各言語での定義

#include <windows.h>

// LVCOLUMNA  (x64 56 / x86 44 バイト)
typedef struct LVCOLUMNA {
    LVCOLUMNW_MASK mask;
    LVCOLUMNW_FORMAT fmt;
    INT cx;
    LPSTR pszText;
    INT cchTextMax;
    INT iSubItem;
    INT iImage;
    INT iOrder;
    INT cxMin;
    INT cxDefault;
    INT cxIdeal;
} LVCOLUMNA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LVCOLUMNA
{
    public uint mask;
    public int fmt;
    public int cx;
    public IntPtr pszText;
    public int cchTextMax;
    public int iSubItem;
    public int iImage;
    public int iOrder;
    public int cxMin;
    public int cxDefault;
    public int cxIdeal;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LVCOLUMNA
    Public mask As UInteger
    Public fmt As Integer
    Public cx As Integer
    Public pszText As IntPtr
    Public cchTextMax As Integer
    Public iSubItem As Integer
    Public iImage As Integer
    Public iOrder As Integer
    Public cxMin As Integer
    Public cxDefault As Integer
    Public cxIdeal As Integer
End Structure
import ctypes
from ctypes import wintypes

class LVCOLUMNA(ctypes.Structure):
    _fields_ = [
        ("mask", wintypes.DWORD),
        ("fmt", ctypes.c_int),
        ("cx", ctypes.c_int),
        ("pszText", ctypes.c_void_p),
        ("cchTextMax", ctypes.c_int),
        ("iSubItem", ctypes.c_int),
        ("iImage", ctypes.c_int),
        ("iOrder", ctypes.c_int),
        ("cxMin", ctypes.c_int),
        ("cxDefault", ctypes.c_int),
        ("cxIdeal", ctypes.c_int),
    ]
#[repr(C)]
pub struct LVCOLUMNA {
    pub mask: u32,
    pub fmt: i32,
    pub cx: i32,
    pub pszText: *mut core::ffi::c_void,
    pub cchTextMax: i32,
    pub iSubItem: i32,
    pub iImage: i32,
    pub iOrder: i32,
    pub cxMin: i32,
    pub cxDefault: i32,
    pub cxIdeal: i32,
}
import "golang.org/x/sys/windows"

type LVCOLUMNA struct {
	mask uint32
	fmt int32
	cx int32
	pszText uintptr
	cchTextMax int32
	iSubItem int32
	iImage int32
	iOrder int32
	cxMin int32
	cxDefault int32
	cxIdeal int32
}
type
  LVCOLUMNA = record
    mask: DWORD;
    fmt: Integer;
    cx: Integer;
    pszText: Pointer;
    cchTextMax: Integer;
    iSubItem: Integer;
    iImage: Integer;
    iOrder: Integer;
    cxMin: Integer;
    cxDefault: Integer;
    cxIdeal: Integer;
  end;
const LVCOLUMNA = extern struct {
    mask: u32,
    fmt: i32,
    cx: i32,
    pszText: ?*anyopaque,
    cchTextMax: i32,
    iSubItem: i32,
    iImage: i32,
    iOrder: i32,
    cxMin: i32,
    cxDefault: i32,
    cxIdeal: i32,
};
type
  LVCOLUMNA {.bycopy.} = object
    mask: uint32
    fmt: int32
    cx: int32
    pszText: pointer
    cchTextMax: int32
    iSubItem: int32
    iImage: int32
    iOrder: int32
    cxMin: int32
    cxDefault: int32
    cxIdeal: int32
struct LVCOLUMNA
{
    uint mask;
    int fmt;
    int cx;
    void* pszText;
    int cchTextMax;
    int iSubItem;
    int iImage;
    int iOrder;
    int cxMin;
    int cxDefault;
    int cxIdeal;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; LVCOLUMNA サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; mask : LVCOLUMNW_MASK (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; fmt : LVCOLUMNW_FORMAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cx : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pszText : LPSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; cchTextMax : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; iSubItem : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; iImage : INT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; iOrder : INT (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; cxMin : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; cxDefault : INT (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; cxIdeal : INT (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LVCOLUMNA サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; mask : LVCOLUMNW_MASK (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; fmt : LVCOLUMNW_FORMAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cx : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pszText : LPSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; cchTextMax : INT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; iSubItem : INT (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; iImage : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; iOrder : INT (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; cxMin : INT (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; cxDefault : INT (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; cxIdeal : INT (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global LVCOLUMNA
    #field int mask
    #field int fmt
    #field int cx
    #field intptr pszText
    #field int cchTextMax
    #field int iSubItem
    #field int iImage
    #field int iOrder
    #field int cxMin
    #field int cxDefault
    #field int cxIdeal
#endstruct

stdim st, LVCOLUMNA        ; NSTRUCT 変数を確保
st->mask = 100
mes "mask=" + st->mask