Win32 API 日本語リファレンス
ホームSystem.AddressBook › DTCTL

DTCTL

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

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

フィールド

フィールドサイズx64x86説明
ulCtlTypeDWORD4+0+0表示テーブルコントロールの種別。DTCT_LABEL/EDIT/LBX等を指定する。
ulCtlFlagsDWORD4+4+4コントロール全般の動作フラグ。DT_REQUIRED/EDITABLE等を組み合わせる。
lpbNotifBYTE*8/4+8+8コントロールの変更通知に使うバイナリデータへのポインタ。
cbNotifDWORD4+16+12lpbNotifが指す通知データのバイト長。
lpszFilterCHAR*8/4+24+16コントロールに適用する入力フィルタ文字列へのポインタ。NULL可。
ulItemIDDWORD4+32+20ダイアログテンプレート内でこのコントロールを識別するアイテムID。
ctl_ctl_e__Union8/4+40+24ulCtlTypeに応じて有効なメンバが変わるコントロール固有データの共用体。

共用体: _ctl_e__Union x64 8B / x86 4B

フィールドサイズx64x86
lpvvoid*8/4+0+0
lplabelDTBLLABEL*8/4+0+0
lpeditDTBLEDIT*8/4+0+0
lplbxDTBLLBX*8/4+0+0
lpcomboboxDTBLCOMBOBOX*8/4+0+0
lpddlbxDTBLDDLBX*8/4+0+0
lpcheckboxDTBLCHECKBOX*8/4+0+0
lpgroupboxDTBLGROUPBOX*8/4+0+0
lpbuttonDTBLBUTTON*8/4+0+0
lpradiobuttonDTBLRADIOBUTTON*8/4+0+0
lpmvlbxDTBLMVLISTBOX*8/4+0+0
lpmvddlbxDTBLMVDDLBX*8/4+0+0
lppageDTBLPAGE*8/4+0+0

各言語での定義

#include <windows.h>

// DTCTL  (x64 48 / x86 28 バイト)
typedef struct DTCTL {
    DWORD ulCtlType;
    DWORD ulCtlFlags;
    BYTE* lpbNotif;
    DWORD cbNotif;
    CHAR* lpszFilter;
    DWORD ulItemID;
    _ctl_e__Union ctl;
} DTCTL;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DTCTL
{
    public uint ulCtlType;
    public uint ulCtlFlags;
    public IntPtr lpbNotif;
    public uint cbNotif;
    public IntPtr lpszFilter;
    public uint ulItemID;
    public _ctl_e__Union ctl;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DTCTL
    Public ulCtlType As UInteger
    Public ulCtlFlags As UInteger
    Public lpbNotif As IntPtr
    Public cbNotif As UInteger
    Public lpszFilter As IntPtr
    Public ulItemID As UInteger
    Public ctl As _ctl_e__Union
End Structure
import ctypes
from ctypes import wintypes

class DTCTL(ctypes.Structure):
    _fields_ = [
        ("ulCtlType", wintypes.DWORD),
        ("ulCtlFlags", wintypes.DWORD),
        ("lpbNotif", ctypes.c_void_p),
        ("cbNotif", wintypes.DWORD),
        ("lpszFilter", ctypes.c_void_p),
        ("ulItemID", wintypes.DWORD),
        ("ctl", _ctl_e__Union),
    ]
#[repr(C)]
pub struct DTCTL {
    pub ulCtlType: u32,
    pub ulCtlFlags: u32,
    pub lpbNotif: *mut core::ffi::c_void,
    pub cbNotif: u32,
    pub lpszFilter: *mut core::ffi::c_void,
    pub ulItemID: u32,
    pub ctl: _ctl_e__Union,
}
import "golang.org/x/sys/windows"

type DTCTL struct {
	ulCtlType uint32
	ulCtlFlags uint32
	lpbNotif uintptr
	cbNotif uint32
	lpszFilter uintptr
	ulItemID uint32
	ctl _ctl_e__Union
}
type
  DTCTL = record
    ulCtlType: DWORD;
    ulCtlFlags: DWORD;
    lpbNotif: Pointer;
    cbNotif: DWORD;
    lpszFilter: Pointer;
    ulItemID: DWORD;
    ctl: _ctl_e__Union;
  end;
const DTCTL = extern struct {
    ulCtlType: u32,
    ulCtlFlags: u32,
    lpbNotif: ?*anyopaque,
    cbNotif: u32,
    lpszFilter: ?*anyopaque,
    ulItemID: u32,
    ctl: _ctl_e__Union,
};
type
  DTCTL {.bycopy.} = object
    ulCtlType: uint32
    ulCtlFlags: uint32
    lpbNotif: pointer
    cbNotif: uint32
    lpszFilter: pointer
    ulItemID: uint32
    ctl: _ctl_e__Union
struct DTCTL
{
    uint ulCtlType;
    uint ulCtlFlags;
    void* lpbNotif;
    uint cbNotif;
    void* lpszFilter;
    uint ulItemID;
    _ctl_e__Union ctl;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DTCTL サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; ulCtlType : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ulCtlFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lpbNotif : BYTE* (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; cbNotif : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lpszFilter : CHAR* (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ulItemID : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ctl : _ctl_e__Union (+24, 4byte)  varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DTCTL サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; ulCtlType : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ulCtlFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lpbNotif : BYTE* (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbNotif : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; lpszFilter : CHAR* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ulItemID : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ctl : _ctl_e__Union (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DTCTL
    #field int ulCtlType
    #field int ulCtlFlags
    #field intptr lpbNotif
    #field int cbNotif
    #field intptr lpszFilter
    #field int ulItemID
    #field byte ctl 8
#endstruct

stdim st, DTCTL        ; NSTRUCT 変数を確保
st->ulCtlType = 100
mes "ulCtlType=" + st->ulCtlType
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。