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

COMBOBOXINFO

構造体
サイズx64: 64 バイト / x86: 52 バイト

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のバイトサイズ。呼び出し前に設定する。
rcItemRECT16+4+4編集フィールドまたは選択項目の矩形(RECT)。
rcButtonRECT16+20+20ドロップダウンボタンの矩形(RECT)。
stateButtonCOMBOBOXINFO_BUTTON_STATE4+36+36ドロップダウンボタンの状態(COMBOBOXINFO_BUTTON_STATE、STATE_SYSTEM_*)。
hwndComboHWND8/4+40+40コンボボックス自体のウィンドウハンドル。
hwndItemHWND8/4+48+44編集コントロールのウィンドウハンドル。
hwndListHWND8/4+56+48ドロップダウンリストのウィンドウハンドル。

各言語での定義

#include <windows.h>

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

// COMBOBOXINFO  (x64 64 / x86 52 バイト)
typedef struct COMBOBOXINFO {
    DWORD cbSize;
    RECT rcItem;
    RECT rcButton;
    COMBOBOXINFO_BUTTON_STATE stateButton;
    HWND hwndCombo;
    HWND hwndItem;
    HWND hwndList;
} COMBOBOXINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COMBOBOXINFO
{
    public uint cbSize;
    public RECT rcItem;
    public RECT rcButton;
    public uint stateButton;
    public IntPtr hwndCombo;
    public IntPtr hwndItem;
    public IntPtr hwndList;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COMBOBOXINFO
    Public cbSize As UInteger
    Public rcItem As RECT
    Public rcButton As RECT
    Public stateButton As UInteger
    Public hwndCombo As IntPtr
    Public hwndItem As IntPtr
    Public hwndList As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class COMBOBOXINFO(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("rcItem", RECT),
        ("rcButton", RECT),
        ("stateButton", wintypes.DWORD),
        ("hwndCombo", ctypes.c_void_p),
        ("hwndItem", ctypes.c_void_p),
        ("hwndList", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct COMBOBOXINFO {
    pub cbSize: u32,
    pub rcItem: RECT,
    pub rcButton: RECT,
    pub stateButton: u32,
    pub hwndCombo: *mut core::ffi::c_void,
    pub hwndItem: *mut core::ffi::c_void,
    pub hwndList: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type COMBOBOXINFO struct {
	cbSize uint32
	rcItem RECT
	rcButton RECT
	stateButton uint32
	hwndCombo uintptr
	hwndItem uintptr
	hwndList uintptr
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  COMBOBOXINFO = record
    cbSize: DWORD;
    rcItem: RECT;
    rcButton: RECT;
    stateButton: DWORD;
    hwndCombo: Pointer;
    hwndItem: Pointer;
    hwndList: Pointer;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const COMBOBOXINFO = extern struct {
    cbSize: u32,
    rcItem: RECT,
    rcButton: RECT,
    stateButton: u32,
    hwndCombo: ?*anyopaque,
    hwndItem: ?*anyopaque,
    hwndList: ?*anyopaque,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  COMBOBOXINFO {.bycopy.} = object
    cbSize: uint32
    rcItem: RECT
    rcButton: RECT
    stateButton: uint32
    hwndCombo: pointer
    hwndItem: pointer
    hwndList: pointer
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct COMBOBOXINFO
{
    uint cbSize;
    RECT rcItem;
    RECT rcButton;
    uint stateButton;
    void* hwndCombo;
    void* hwndItem;
    void* hwndList;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; COMBOBOXINFO サイズ: 52 バイト(x86)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; rcItem : RECT (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; rcButton : RECT (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; stateButton : COMBOBOXINFO_BUTTON_STATE (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; hwndCombo : HWND (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; hwndItem : HWND (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; hwndList : HWND (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COMBOBOXINFO サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; rcItem : RECT (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; rcButton : RECT (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; stateButton : COMBOBOXINFO_BUTTON_STATE (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; hwndCombo : HWND (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; hwndItem : HWND (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; hwndList : HWND (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global COMBOBOXINFO
    #field int cbSize
    #field RECT rcItem
    #field RECT rcButton
    #field int stateButton
    #field intptr hwndCombo
    #field intptr hwndItem
    #field intptr hwndList
#endstruct

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