ホーム › System.DataExchange › MONCBSTRUCT
MONCBSTRUCT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cb | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。 |
| dwTime | DWORD | 4 | +4 | +4 | コールバック発生時刻(Windows時間)。 |
| hTask | HANDLE | 8/4 | +8 | +8 | コールバックを受けるタスクのハンドル。 |
| dwRet | DWORD | 4 | +16 | +12 | コールバックの戻り値。 |
| wType | DWORD | 4 | +20 | +16 | トランザクションの種別。 |
| wFmt | DWORD | 4 | +24 | +20 | データ形式。 |
| hConv | HCONV | 8/4 | +32 | +24 | 会話のハンドル(HCONV)。 |
| hsz1 | HSZ | 8/4 | +40 | +28 | 第1の文字列ハンドル(HSZ)。 |
| hsz2 | HSZ | 8/4 | +48 | +32 | 第2の文字列ハンドル(HSZ)。 |
| hData | HDDEDATA | 8/4 | +56 | +36 | DDEデータハンドル(HDDEDATA)。 |
| dwData1 | UINT_PTR | 8/4 | +64 | +40 | コールバックの第1データ値(UINT_PTR)。 |
| dwData2 | UINT_PTR | 8/4 | +72 | +44 | コールバックの第2データ値(UINT_PTR)。 |
| cc | CONVCONTEXT | 36 | +80 | +48 | 会話コンテキスト情報(CONVCONTEXT)。 |
| cbData | DWORD | 4 | +116 | +84 | Dataが指すデータのバイト数。 |
| Data | DWORD | 32 | +120 | +88 | コールバックに関連付けられたデータの先頭DWORD。 |
各言語での定義
#include <windows.h>
// SECURITY_QUALITY_OF_SERVICE (x64 12 / x86 12 バイト)
typedef struct SECURITY_QUALITY_OF_SERVICE {
DWORD Length;
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
BYTE ContextTrackingMode;
BOOLEAN EffectiveOnly;
} SECURITY_QUALITY_OF_SERVICE;
// CONVCONTEXT (x64 36 / x86 36 バイト)
typedef struct CONVCONTEXT {
DWORD cb;
DWORD wFlags;
DWORD wCountryID;
INT iCodePage;
DWORD dwLangID;
DWORD dwSecurity;
SECURITY_QUALITY_OF_SERVICE qos;
} CONVCONTEXT;
// MONCBSTRUCT (x64 152 / x86 120 バイト)
typedef struct MONCBSTRUCT {
DWORD cb;
DWORD dwTime;
HANDLE hTask;
DWORD dwRet;
DWORD wType;
DWORD wFmt;
HCONV hConv;
HSZ hsz1;
HSZ hsz2;
HDDEDATA hData;
UINT_PTR dwData1;
UINT_PTR dwData2;
CONVCONTEXT cc;
DWORD cbData;
DWORD Data[8];
} MONCBSTRUCT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECURITY_QUALITY_OF_SERVICE
{
public uint Length;
public int ImpersonationLevel;
public byte ContextTrackingMode;
[MarshalAs(UnmanagedType.U1)] public bool EffectiveOnly;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CONVCONTEXT
{
public uint cb;
public uint wFlags;
public uint wCountryID;
public int iCodePage;
public uint dwLangID;
public uint dwSecurity;
public SECURITY_QUALITY_OF_SERVICE qos;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MONCBSTRUCT
{
public uint cb;
public uint dwTime;
public IntPtr hTask;
public uint dwRet;
public uint wType;
public uint wFmt;
public IntPtr hConv;
public IntPtr hsz1;
public IntPtr hsz2;
public IntPtr hData;
public UIntPtr dwData1;
public UIntPtr dwData2;
public CONVCONTEXT cc;
public uint cbData;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] Data;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SECURITY_QUALITY_OF_SERVICE
Public Length As UInteger
Public ImpersonationLevel As Integer
Public ContextTrackingMode As Byte
<MarshalAs(UnmanagedType.U1)> Public EffectiveOnly As Boolean
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CONVCONTEXT
Public cb As UInteger
Public wFlags As UInteger
Public wCountryID As UInteger
Public iCodePage As Integer
Public dwLangID As UInteger
Public dwSecurity As UInteger
Public qos As SECURITY_QUALITY_OF_SERVICE
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MONCBSTRUCT
Public cb As UInteger
Public dwTime As UInteger
Public hTask As IntPtr
Public dwRet As UInteger
Public wType As UInteger
Public wFmt As UInteger
Public hConv As IntPtr
Public hsz1 As IntPtr
Public hsz2 As IntPtr
Public hData As IntPtr
Public dwData1 As UIntPtr
Public dwData2 As UIntPtr
Public cc As CONVCONTEXT
Public cbData As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public Data() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SECURITY_QUALITY_OF_SERVICE(ctypes.Structure):
_fields_ = [
("Length", wintypes.DWORD),
("ImpersonationLevel", ctypes.c_int),
("ContextTrackingMode", ctypes.c_ubyte),
("EffectiveOnly", ctypes.c_byte),
]
class CONVCONTEXT(ctypes.Structure):
_fields_ = [
("cb", wintypes.DWORD),
("wFlags", wintypes.DWORD),
("wCountryID", wintypes.DWORD),
("iCodePage", ctypes.c_int),
("dwLangID", wintypes.DWORD),
("dwSecurity", wintypes.DWORD),
("qos", SECURITY_QUALITY_OF_SERVICE),
]
class MONCBSTRUCT(ctypes.Structure):
_fields_ = [
("cb", wintypes.DWORD),
("dwTime", wintypes.DWORD),
("hTask", ctypes.c_void_p),
("dwRet", wintypes.DWORD),
("wType", wintypes.DWORD),
("wFmt", wintypes.DWORD),
("hConv", ctypes.c_void_p),
("hsz1", ctypes.c_void_p),
("hsz2", ctypes.c_void_p),
("hData", ctypes.c_void_p),
("dwData1", ctypes.c_size_t),
("dwData2", ctypes.c_size_t),
("cc", CONVCONTEXT),
("cbData", wintypes.DWORD),
("Data", wintypes.DWORD * 8),
]#[repr(C)]
pub struct SECURITY_QUALITY_OF_SERVICE {
pub Length: u32,
pub ImpersonationLevel: i32,
pub ContextTrackingMode: u8,
pub EffectiveOnly: u8,
}
#[repr(C)]
pub struct CONVCONTEXT {
pub cb: u32,
pub wFlags: u32,
pub wCountryID: u32,
pub iCodePage: i32,
pub dwLangID: u32,
pub dwSecurity: u32,
pub qos: SECURITY_QUALITY_OF_SERVICE,
}
#[repr(C)]
pub struct MONCBSTRUCT {
pub cb: u32,
pub dwTime: u32,
pub hTask: *mut core::ffi::c_void,
pub dwRet: u32,
pub wType: u32,
pub wFmt: u32,
pub hConv: *mut core::ffi::c_void,
pub hsz1: *mut core::ffi::c_void,
pub hsz2: *mut core::ffi::c_void,
pub hData: *mut core::ffi::c_void,
pub dwData1: usize,
pub dwData2: usize,
pub cc: CONVCONTEXT,
pub cbData: u32,
pub Data: [u32; 8],
}import "golang.org/x/sys/windows"
type SECURITY_QUALITY_OF_SERVICE struct {
Length uint32
ImpersonationLevel int32
ContextTrackingMode byte
EffectiveOnly byte
}
type CONVCONTEXT struct {
cb uint32
wFlags uint32
wCountryID uint32
iCodePage int32
dwLangID uint32
dwSecurity uint32
qos SECURITY_QUALITY_OF_SERVICE
}
type MONCBSTRUCT struct {
cb uint32
dwTime uint32
hTask uintptr
dwRet uint32
wType uint32
wFmt uint32
hConv uintptr
hsz1 uintptr
hsz2 uintptr
hData uintptr
dwData1 uintptr
dwData2 uintptr
cc CONVCONTEXT
cbData uint32
Data [8]uint32
}type
SECURITY_QUALITY_OF_SERVICE = record
Length: DWORD;
ImpersonationLevel: Integer;
ContextTrackingMode: Byte;
EffectiveOnly: ByteBool;
end;
CONVCONTEXT = record
cb: DWORD;
wFlags: DWORD;
wCountryID: DWORD;
iCodePage: Integer;
dwLangID: DWORD;
dwSecurity: DWORD;
qos: SECURITY_QUALITY_OF_SERVICE;
end;
MONCBSTRUCT = record
cb: DWORD;
dwTime: DWORD;
hTask: Pointer;
dwRet: DWORD;
wType: DWORD;
wFmt: DWORD;
hConv: Pointer;
hsz1: Pointer;
hsz2: Pointer;
hData: Pointer;
dwData1: NativeUInt;
dwData2: NativeUInt;
cc: CONVCONTEXT;
cbData: DWORD;
Data: array[0..7] of DWORD;
end;const SECURITY_QUALITY_OF_SERVICE = extern struct {
Length: u32,
ImpersonationLevel: i32,
ContextTrackingMode: u8,
EffectiveOnly: u8,
};
const CONVCONTEXT = extern struct {
cb: u32,
wFlags: u32,
wCountryID: u32,
iCodePage: i32,
dwLangID: u32,
dwSecurity: u32,
qos: SECURITY_QUALITY_OF_SERVICE,
};
const MONCBSTRUCT = extern struct {
cb: u32,
dwTime: u32,
hTask: ?*anyopaque,
dwRet: u32,
wType: u32,
wFmt: u32,
hConv: ?*anyopaque,
hsz1: ?*anyopaque,
hsz2: ?*anyopaque,
hData: ?*anyopaque,
dwData1: usize,
dwData2: usize,
cc: CONVCONTEXT,
cbData: u32,
Data: [8]u32,
};type
SECURITY_QUALITY_OF_SERVICE {.bycopy.} = object
Length: uint32
ImpersonationLevel: int32
ContextTrackingMode: uint8
EffectiveOnly: uint8
CONVCONTEXT {.bycopy.} = object
cb: uint32
wFlags: uint32
wCountryID: uint32
iCodePage: int32
dwLangID: uint32
dwSecurity: uint32
qos: SECURITY_QUALITY_OF_SERVICE
MONCBSTRUCT {.bycopy.} = object
cb: uint32
dwTime: uint32
hTask: pointer
dwRet: uint32
wType: uint32
wFmt: uint32
hConv: pointer
hsz1: pointer
hsz2: pointer
hData: pointer
dwData1: uint
dwData2: uint
cc: CONVCONTEXT
cbData: uint32
Data: array[8, uint32]struct SECURITY_QUALITY_OF_SERVICE
{
uint Length;
int ImpersonationLevel;
ubyte ContextTrackingMode;
ubyte EffectiveOnly;
}
struct CONVCONTEXT
{
uint cb;
uint wFlags;
uint wCountryID;
int iCodePage;
uint dwLangID;
uint dwSecurity;
SECURITY_QUALITY_OF_SERVICE qos;
}
struct MONCBSTRUCT
{
uint cb;
uint dwTime;
void* hTask;
uint dwRet;
uint wType;
uint wFmt;
void* hConv;
void* hsz1;
void* hsz2;
void* hData;
size_t dwData1;
size_t dwData2;
CONVCONTEXT cc;
uint cbData;
uint[8] Data;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MONCBSTRUCT サイズ: 120 バイト(x86)
dim st, 30 ; 4byte整数×30(構造体サイズ 120 / 4 切り上げ)
; cb : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwTime : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hTask : HANDLE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwRet : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; wType : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; wFmt : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; hConv : HCONV (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; hsz1 : HSZ (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; hsz2 : HSZ (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; hData : HDDEDATA (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwData1 : UINT_PTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwData2 : UINT_PTR (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; cc : CONVCONTEXT (+48, 36byte) varptr(st)+48 を基点に操作(36byte:入れ子/配列)
; cbData : DWORD (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; Data : DWORD (+88, 32byte) varptr(st)+88 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MONCBSTRUCT サイズ: 152 バイト(x64)
dim st, 38 ; 4byte整数×38(構造体サイズ 152 / 4 切り上げ)
; cb : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwTime : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hTask : HANDLE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dwRet : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; wType : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; wFmt : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; hConv : HCONV (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; hsz1 : HSZ (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; hsz2 : HSZ (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; hData : HDDEDATA (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; dwData1 : UINT_PTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; dwData2 : UINT_PTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; cc : CONVCONTEXT (+80, 36byte) varptr(st)+80 を基点に操作(36byte:入れ子/配列)
; cbData : DWORD (+116, 4byte) st.29 = 値 / 値 = st.29 (lpoke/lpeek も可)
; Data : DWORD (+120, 32byte) varptr(st)+120 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SECURITY_QUALITY_OF_SERVICE
#field int Length
#field int ImpersonationLevel
#field byte ContextTrackingMode
#field bool1 EffectiveOnly
#endstruct
#defstruct global CONVCONTEXT
#field int cb
#field int wFlags
#field int wCountryID
#field int iCodePage
#field int dwLangID
#field int dwSecurity
#field SECURITY_QUALITY_OF_SERVICE qos
#endstruct
#defstruct global MONCBSTRUCT
#field int cb
#field int dwTime
#field intptr hTask
#field int dwRet
#field int wType
#field int wFmt
#field intptr hConv
#field intptr hsz1
#field intptr hsz2
#field intptr hData
#field intptr dwData1
#field intptr dwData2
#field CONVCONTEXT cc
#field int cbData
#field int Data 8
#endstruct
stdim st, MONCBSTRUCT ; NSTRUCT 変数を確保
st->cb = 100
mes "cb=" + st->cb