Win32 API 日本語リファレンス
ホームGraphics.Printing › OPTCOMBO

OPTCOMBO

構造体
サイズx64: 32 バイト / x86: 28 バイト

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

フィールド

フィールドサイズx64x86説明
cbSizeWORD2+0+0本構造体のサイズ(バイト単位)。
FlagsBYTE1+2+2コンボボックスの動作を制御するビットフラグ。
cListItemWORD2+4+4pListItem配列に含まれるリスト項目数。
pListItemOPTPARAM*8/4+8+8コンボボックスの各項目を表すOPTPARAM配列へのポインタ。
SelINT4+16+12現在選択されている項目のインデックス。未選択は-1。
dwReservedDWORD12+20+16予約フィールド。0を設定する。

各言語での定義

#include <windows.h>

// OPTCOMBO  (x64 32 / x86 28 バイト)
typedef struct OPTCOMBO {
    WORD cbSize;
    BYTE Flags;
    WORD cListItem;
    OPTPARAM* pListItem;
    INT Sel;
    DWORD dwReserved[3];
} OPTCOMBO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OPTCOMBO
{
    public ushort cbSize;
    public byte Flags;
    public ushort cListItem;
    public IntPtr pListItem;
    public int Sel;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] dwReserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure OPTCOMBO
    Public cbSize As UShort
    Public Flags As Byte
    Public cListItem As UShort
    Public pListItem As IntPtr
    Public Sel As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public dwReserved() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class OPTCOMBO(ctypes.Structure):
    _fields_ = [
        ("cbSize", ctypes.c_ushort),
        ("Flags", ctypes.c_ubyte),
        ("cListItem", ctypes.c_ushort),
        ("pListItem", ctypes.c_void_p),
        ("Sel", ctypes.c_int),
        ("dwReserved", wintypes.DWORD * 3),
    ]
#[repr(C)]
pub struct OPTCOMBO {
    pub cbSize: u16,
    pub Flags: u8,
    pub cListItem: u16,
    pub pListItem: *mut core::ffi::c_void,
    pub Sel: i32,
    pub dwReserved: [u32; 3],
}
import "golang.org/x/sys/windows"

type OPTCOMBO struct {
	cbSize uint16
	Flags byte
	cListItem uint16
	pListItem uintptr
	Sel int32
	dwReserved [3]uint32
}
type
  OPTCOMBO = record
    cbSize: Word;
    Flags: Byte;
    cListItem: Word;
    pListItem: Pointer;
    Sel: Integer;
    dwReserved: array[0..2] of DWORD;
  end;
const OPTCOMBO = extern struct {
    cbSize: u16,
    Flags: u8,
    cListItem: u16,
    pListItem: ?*anyopaque,
    Sel: i32,
    dwReserved: [3]u32,
};
type
  OPTCOMBO {.bycopy.} = object
    cbSize: uint16
    Flags: uint8
    cListItem: uint16
    pListItem: pointer
    Sel: int32
    dwReserved: array[3, uint32]
struct OPTCOMBO
{
    ushort cbSize;
    ubyte Flags;
    ushort cListItem;
    void* pListItem;
    int Sel;
    uint[3] dwReserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; OPTCOMBO サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; cbSize : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Flags : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; cListItem : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; pListItem : OPTPARAM* (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; Sel : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwReserved : DWORD (+16, 12byte)  varptr(st)+16 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OPTCOMBO サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; cbSize : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Flags : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; cListItem : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; pListItem : OPTPARAM* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; Sel : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwReserved : DWORD (+20, 12byte)  varptr(st)+20 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global OPTCOMBO
    #field short cbSize
    #field byte Flags
    #field short cListItem
    #field intptr pListItem
    #field int Sel
    #field int dwReserved 3
#endstruct

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