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

CONVINFO

構造体
サイズx64: 144 バイト / x86: 96 バイト

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

フィールド

フィールドサイズx64x86説明
cbDWORD4+0+0この構造体のバイトサイズ。
hUserUINT_PTR8/4+8+4アプリケーション定義のユーザーデータ(UINT_PTR)。
hConvPartnerHCONV8/4+16+8相手側会話のハンドル(HCONV)。
hszSvcPartnerHSZ8/4+24+12相手側サービス名の文字列ハンドル(HSZ)。
hszServiceReqHSZ8/4+32+16要求されたサービス名の文字列ハンドル(HSZ)。
hszTopicHSZ8/4+40+20トピック名の文字列ハンドル(HSZ)。
hszItemHSZ8/4+48+24現在のデータ項目名の文字列ハンドル(HSZ)。
wFmtDWORD4+56+28現在のデータ形式。
wTypeDDE_CLIENT_TRANSACTION_TYPE4+60+32現在のトランザクション種別(DDE_CLIENT_TRANSACTION_TYPE)。
wStatusCONVINFO_STATUS4+64+36会話のステータスを示すフラグ(CONVINFO_STATUS)。
wConvstCONVINFO_CONVERSATION_STATE4+68+40会話の状態を示す値(CONVINFO_CONVERSATION_STATE)。
wLastErrorDWORD4+72+44直近のエラーコード。
hConvListHCONVLIST8/4+80+48この会話を含む会話リストのハンドル(HCONVLIST)。
ConvCtxtCONVCONTEXT36+88+52会話コンテキスト情報(CONVCONTEXT)。
hwndHWND8/4+128+88この会話のウィンドウハンドル。
hwndPartnerHWND8/4+136+92相手側会話のウィンドウハンドル。

各言語での定義

#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;

// CONVINFO  (x64 144 / x86 96 バイト)
typedef struct CONVINFO {
    DWORD cb;
    UINT_PTR hUser;
    HCONV hConvPartner;
    HSZ hszSvcPartner;
    HSZ hszServiceReq;
    HSZ hszTopic;
    HSZ hszItem;
    DWORD wFmt;
    DDE_CLIENT_TRANSACTION_TYPE wType;
    CONVINFO_STATUS wStatus;
    CONVINFO_CONVERSATION_STATE wConvst;
    DWORD wLastError;
    HCONVLIST hConvList;
    CONVCONTEXT ConvCtxt;
    HWND hwnd;
    HWND hwndPartner;
} CONVINFO;
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 CONVINFO
{
    public uint cb;
    public UIntPtr hUser;
    public IntPtr hConvPartner;
    public IntPtr hszSvcPartner;
    public IntPtr hszServiceReq;
    public IntPtr hszTopic;
    public IntPtr hszItem;
    public uint wFmt;
    public uint wType;
    public uint wStatus;
    public uint wConvst;
    public uint wLastError;
    public IntPtr hConvList;
    public CONVCONTEXT ConvCtxt;
    public IntPtr hwnd;
    public IntPtr hwndPartner;
}
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 CONVINFO
    Public cb As UInteger
    Public hUser As UIntPtr
    Public hConvPartner As IntPtr
    Public hszSvcPartner As IntPtr
    Public hszServiceReq As IntPtr
    Public hszTopic As IntPtr
    Public hszItem As IntPtr
    Public wFmt As UInteger
    Public wType As UInteger
    Public wStatus As UInteger
    Public wConvst As UInteger
    Public wLastError As UInteger
    Public hConvList As IntPtr
    Public ConvCtxt As CONVCONTEXT
    Public hwnd As IntPtr
    Public hwndPartner As IntPtr
End Structure
import 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 CONVINFO(ctypes.Structure):
    _fields_ = [
        ("cb", wintypes.DWORD),
        ("hUser", ctypes.c_size_t),
        ("hConvPartner", ctypes.c_void_p),
        ("hszSvcPartner", ctypes.c_void_p),
        ("hszServiceReq", ctypes.c_void_p),
        ("hszTopic", ctypes.c_void_p),
        ("hszItem", ctypes.c_void_p),
        ("wFmt", wintypes.DWORD),
        ("wType", wintypes.DWORD),
        ("wStatus", wintypes.DWORD),
        ("wConvst", wintypes.DWORD),
        ("wLastError", wintypes.DWORD),
        ("hConvList", ctypes.c_void_p),
        ("ConvCtxt", CONVCONTEXT),
        ("hwnd", ctypes.c_void_p),
        ("hwndPartner", ctypes.c_void_p),
    ]
#[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 CONVINFO {
    pub cb: u32,
    pub hUser: usize,
    pub hConvPartner: *mut core::ffi::c_void,
    pub hszSvcPartner: *mut core::ffi::c_void,
    pub hszServiceReq: *mut core::ffi::c_void,
    pub hszTopic: *mut core::ffi::c_void,
    pub hszItem: *mut core::ffi::c_void,
    pub wFmt: u32,
    pub wType: u32,
    pub wStatus: u32,
    pub wConvst: u32,
    pub wLastError: u32,
    pub hConvList: *mut core::ffi::c_void,
    pub ConvCtxt: CONVCONTEXT,
    pub hwnd: *mut core::ffi::c_void,
    pub hwndPartner: *mut core::ffi::c_void,
}
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 CONVINFO struct {
	cb uint32
	hUser uintptr
	hConvPartner uintptr
	hszSvcPartner uintptr
	hszServiceReq uintptr
	hszTopic uintptr
	hszItem uintptr
	wFmt uint32
	wType uint32
	wStatus uint32
	wConvst uint32
	wLastError uint32
	hConvList uintptr
	ConvCtxt CONVCONTEXT
	hwnd uintptr
	hwndPartner uintptr
}
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;

  CONVINFO = record
    cb: DWORD;
    hUser: NativeUInt;
    hConvPartner: Pointer;
    hszSvcPartner: Pointer;
    hszServiceReq: Pointer;
    hszTopic: Pointer;
    hszItem: Pointer;
    wFmt: DWORD;
    wType: DWORD;
    wStatus: DWORD;
    wConvst: DWORD;
    wLastError: DWORD;
    hConvList: Pointer;
    ConvCtxt: CONVCONTEXT;
    hwnd: Pointer;
    hwndPartner: Pointer;
  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 CONVINFO = extern struct {
    cb: u32,
    hUser: usize,
    hConvPartner: ?*anyopaque,
    hszSvcPartner: ?*anyopaque,
    hszServiceReq: ?*anyopaque,
    hszTopic: ?*anyopaque,
    hszItem: ?*anyopaque,
    wFmt: u32,
    wType: u32,
    wStatus: u32,
    wConvst: u32,
    wLastError: u32,
    hConvList: ?*anyopaque,
    ConvCtxt: CONVCONTEXT,
    hwnd: ?*anyopaque,
    hwndPartner: ?*anyopaque,
};
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

  CONVINFO {.bycopy.} = object
    cb: uint32
    hUser: uint
    hConvPartner: pointer
    hszSvcPartner: pointer
    hszServiceReq: pointer
    hszTopic: pointer
    hszItem: pointer
    wFmt: uint32
    wType: uint32
    wStatus: uint32
    wConvst: uint32
    wLastError: uint32
    hConvList: pointer
    ConvCtxt: CONVCONTEXT
    hwnd: pointer
    hwndPartner: pointer
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 CONVINFO
{
    uint cb;
    size_t hUser;
    void* hConvPartner;
    void* hszSvcPartner;
    void* hszServiceReq;
    void* hszTopic;
    void* hszItem;
    uint wFmt;
    uint wType;
    uint wStatus;
    uint wConvst;
    uint wLastError;
    void* hConvList;
    CONVCONTEXT ConvCtxt;
    void* hwnd;
    void* hwndPartner;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CONVINFO サイズ: 96 バイト(x86)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; cb : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hUser : UINT_PTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; hConvPartner : HCONV (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; hszSvcPartner : HSZ (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; hszServiceReq : HSZ (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; hszTopic : HSZ (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; hszItem : HSZ (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; wFmt : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; wType : DDE_CLIENT_TRANSACTION_TYPE (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; wStatus : CONVINFO_STATUS (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; wConvst : CONVINFO_CONVERSATION_STATE (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; wLastError : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; hConvList : HCONVLIST (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ConvCtxt : CONVCONTEXT (+52, 36byte)  varptr(st)+52 を基点に操作(36byte:入れ子/配列)
; hwnd : HWND (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; hwndPartner : HWND (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CONVINFO サイズ: 144 バイト(x64)
dim st, 36    ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; cb : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hUser : UINT_PTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; hConvPartner : HCONV (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hszSvcPartner : HSZ (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; hszServiceReq : HSZ (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; hszTopic : HSZ (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; hszItem : HSZ (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; wFmt : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; wType : DDE_CLIENT_TRANSACTION_TYPE (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; wStatus : CONVINFO_STATUS (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; wConvst : CONVINFO_CONVERSATION_STATE (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; wLastError : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; hConvList : HCONVLIST (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ConvCtxt : CONVCONTEXT (+88, 36byte)  varptr(st)+88 を基点に操作(36byte:入れ子/配列)
; hwnd : HWND (+128, 8byte)  qpoke st,128,値 / qpeek(st,128)  ※IronHSPのみ。3.7/3.8は lpoke st,128,下位 : lpoke st,132,上位
; hwndPartner : HWND (+136, 8byte)  qpoke st,136,値 / qpeek(st,136)  ※IronHSPのみ。3.7/3.8は lpoke st,136,下位 : lpoke st,140,上位
; ※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 CONVINFO
    #field int cb
    #field intptr hUser
    #field intptr hConvPartner
    #field intptr hszSvcPartner
    #field intptr hszServiceReq
    #field intptr hszTopic
    #field intptr hszItem
    #field int wFmt
    #field int wType
    #field int wStatus
    #field int wConvst
    #field int wLastError
    #field intptr hConvList
    #field CONVCONTEXT ConvCtxt
    #field intptr hwnd
    #field intptr hwndPartner
#endstruct

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