ホーム › System.DataExchange › DdeQueryConvInfo
DdeQueryConvInfo
関数指定したDDE会話とトランザクションの情報を取得する。
シグネチャ
// USER32.dll
#include <windows.h>
DWORD DdeQueryConvInfo(
HCONV hConv,
DWORD idTransaction,
CONVINFO* pConvInfo
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hConv | HCONV | in | 会話へのハンドルです。 |
| idTransaction | DWORD | in | トランザクションです。非同期トランザクションの場合、このパラメーターには DdeClientTransaction 関数が返したトランザクション識別子を指定します。同期トランザクションの場合、このパラメーターには QID_SYNC を指定します。 |
| pConvInfo | CONVINFO* | inout | トランザクションおよび会話に関する情報を受け取る CONVINFO 構造体へのポインターです。 CONVINFO 構造体の cb メンバーには、この構造体用に確保したバッファーの長さを指定する必要があります。 |
戻り値の型: DWORD
公式ドキュメント
動的データ交換(DDE)トランザクション、およびそのトランザクションが行われる会話に関する情報を取得します。
戻り値
型: UINT
関数が成功した場合、戻り値は CONVINFO 構造体にコピーされたバイト数です。
関数が失敗した場合、戻り値は FALSE です。
DdeGetLastError 関数を使用してエラーコードを取得できます。エラーコードは次のいずれかの値になります。
解説(Remarks)
アプリケーションは、CONVINFO 構造体が参照する文字列ハンドルを解放してはなりません。これらの文字列ハンドルのいずれかを使用する必要がある場合は、DdeKeepStringHandle 関数を呼び出してハンドルのコピーを作成してください。
idTransaction パラメーターに QID_SYNC を設定した場合、CONVINFO 構造体の hUser メンバーは会話に関連付けられ、その会話に関連するデータを保持するために使用できます。idTransaction が非同期トランザクションの識別子である場合、hUser メンバーは現在のトランザクションにのみ関連付けられ、そのトランザクションの実行中のみ有効です。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
DWORD DdeQueryConvInfo(
HCONV hConv,
DWORD idTransaction,
CONVINFO* pConvInfo
);[DllImport("USER32.dll", ExactSpelling = true)]
static extern uint DdeQueryConvInfo(
IntPtr hConv, // HCONV
uint idTransaction, // DWORD
IntPtr pConvInfo // CONVINFO* in/out
);<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function DdeQueryConvInfo(
hConv As IntPtr, ' HCONV
idTransaction As UInteger, ' DWORD
pConvInfo As IntPtr ' CONVINFO* in/out
) As UInteger
End Function' hConv : HCONV
' idTransaction : DWORD
' pConvInfo : CONVINFO* in/out
Declare PtrSafe Function DdeQueryConvInfo Lib "user32" ( _
ByVal hConv As LongPtr, _
ByVal idTransaction As Long, _
ByVal pConvInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DdeQueryConvInfo = ctypes.windll.user32.DdeQueryConvInfo
DdeQueryConvInfo.restype = wintypes.DWORD
DdeQueryConvInfo.argtypes = [
wintypes.HANDLE, # hConv : HCONV
wintypes.DWORD, # idTransaction : DWORD
ctypes.c_void_p, # pConvInfo : CONVINFO* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
DdeQueryConvInfo = Fiddle::Function.new(
lib['DdeQueryConvInfo'],
[
Fiddle::TYPE_VOIDP, # hConv : HCONV
-Fiddle::TYPE_INT, # idTransaction : DWORD
Fiddle::TYPE_VOIDP, # pConvInfo : CONVINFO* in/out
],
-Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn DdeQueryConvInfo(
hConv: *mut core::ffi::c_void, // HCONV
idTransaction: u32, // DWORD
pConvInfo: *mut CONVINFO // CONVINFO* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll")]
public static extern uint DdeQueryConvInfo(IntPtr hConv, uint idTransaction, IntPtr pConvInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DdeQueryConvInfo' -Namespace Win32 -PassThru
# $api::DdeQueryConvInfo(hConv, idTransaction, pConvInfo)#uselib "USER32.dll"
#func global DdeQueryConvInfo "DdeQueryConvInfo" sptr, sptr, sptr
; DdeQueryConvInfo hConv, idTransaction, varptr(pConvInfo) ; 戻り値は stat
; hConv : HCONV -> "sptr"
; idTransaction : DWORD -> "sptr"
; pConvInfo : CONVINFO* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global DdeQueryConvInfo "DdeQueryConvInfo" sptr, int, var ; res = DdeQueryConvInfo(hConv, idTransaction, pConvInfo) ; hConv : HCONV -> "sptr" ; idTransaction : DWORD -> "int" ; pConvInfo : CONVINFO* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global DdeQueryConvInfo "DdeQueryConvInfo" sptr, int, sptr ; res = DdeQueryConvInfo(hConv, idTransaction, varptr(pConvInfo)) ; hConv : HCONV -> "sptr" ; idTransaction : DWORD -> "int" ; pConvInfo : CONVINFO* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD DdeQueryConvInfo(HCONV hConv, DWORD idTransaction, CONVINFO* pConvInfo) #uselib "USER32.dll" #cfunc global DdeQueryConvInfo "DdeQueryConvInfo" intptr, int, var ; res = DdeQueryConvInfo(hConv, idTransaction, pConvInfo) ; hConv : HCONV -> "intptr" ; idTransaction : DWORD -> "int" ; pConvInfo : CONVINFO* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD DdeQueryConvInfo(HCONV hConv, DWORD idTransaction, CONVINFO* pConvInfo) #uselib "USER32.dll" #cfunc global DdeQueryConvInfo "DdeQueryConvInfo" intptr, int, intptr ; res = DdeQueryConvInfo(hConv, idTransaction, varptr(pConvInfo)) ; hConv : HCONV -> "intptr" ; idTransaction : DWORD -> "int" ; pConvInfo : CONVINFO* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procDdeQueryConvInfo = user32.NewProc("DdeQueryConvInfo")
)
// hConv (HCONV), idTransaction (DWORD), pConvInfo (CONVINFO* in/out)
r1, _, err := procDdeQueryConvInfo.Call(
uintptr(hConv),
uintptr(idTransaction),
uintptr(pConvInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction DdeQueryConvInfo(
hConv: THandle; // HCONV
idTransaction: DWORD; // DWORD
pConvInfo: Pointer // CONVINFO* in/out
): DWORD; stdcall;
external 'USER32.dll' name 'DdeQueryConvInfo';result := DllCall("USER32\DdeQueryConvInfo"
, "Ptr", hConv ; HCONV
, "UInt", idTransaction ; DWORD
, "Ptr", pConvInfo ; CONVINFO* in/out
, "UInt") ; return: DWORD●DdeQueryConvInfo(hConv, idTransaction, pConvInfo) = DLL("USER32.dll", "dword DdeQueryConvInfo(void*, dword, void*)")
# 呼び出し: DdeQueryConvInfo(hConv, idTransaction, pConvInfo)
# hConv : HCONV -> "void*"
# idTransaction : DWORD -> "dword"
# pConvInfo : CONVINFO* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "user32" fn DdeQueryConvInfo(
hConv: ?*anyopaque, // HCONV
idTransaction: u32, // DWORD
pConvInfo: [*c]CONVINFO // CONVINFO* in/out
) callconv(std.os.windows.WINAPI) u32;proc DdeQueryConvInfo(
hConv: pointer, # HCONV
idTransaction: uint32, # DWORD
pConvInfo: ptr CONVINFO # CONVINFO* in/out
): uint32 {.importc: "DdeQueryConvInfo", stdcall, dynlib: "USER32.dll".}pragma(lib, "user32");
extern(Windows)
uint DdeQueryConvInfo(
void* hConv, // HCONV
uint idTransaction, // DWORD
CONVINFO* pConvInfo // CONVINFO* in/out
);ccall((:DdeQueryConvInfo, "USER32.dll"), stdcall, UInt32,
(Ptr{Cvoid}, UInt32, Ptr{CONVINFO}),
hConv, idTransaction, pConvInfo)
# hConv : HCONV -> Ptr{Cvoid}
# idTransaction : DWORD -> UInt32
# pConvInfo : CONVINFO* in/out -> Ptr{CONVINFO}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t DdeQueryConvInfo(
void* hConv,
uint32_t idTransaction,
void* pConvInfo);
]]
local user32 = ffi.load("user32")
-- user32.DdeQueryConvInfo(hConv, idTransaction, pConvInfo)
-- hConv : HCONV
-- idTransaction : DWORD
-- pConvInfo : CONVINFO* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('USER32.dll');
const DdeQueryConvInfo = lib.func('__stdcall', 'DdeQueryConvInfo', 'uint32_t', ['void *', 'uint32_t', 'void *']);
// DdeQueryConvInfo(hConv, idTransaction, pConvInfo)
// hConv : HCONV -> 'void *'
// idTransaction : DWORD -> 'uint32_t'
// pConvInfo : CONVINFO* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("USER32.dll", {
DdeQueryConvInfo: { parameters: ["pointer", "u32", "pointer"], result: "u32" },
});
// lib.symbols.DdeQueryConvInfo(hConv, idTransaction, pConvInfo)
// hConv : HCONV -> "pointer"
// idTransaction : DWORD -> "u32"
// pConvInfo : CONVINFO* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t DdeQueryConvInfo(
void* hConv,
uint32_t idTransaction,
void* pConvInfo);
C, "USER32.dll");
// $ffi->DdeQueryConvInfo(hConv, idTransaction, pConvInfo);
// hConv : HCONV
// idTransaction : DWORD
// pConvInfo : CONVINFO* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface User32 extends StdCallLibrary {
User32 INSTANCE = Native.load("user32", User32.class);
int DdeQueryConvInfo(
Pointer hConv, // HCONV
int idTransaction, // DWORD
Pointer pConvInfo // CONVINFO* in/out
);
}@[Link("user32")]
lib LibUSER32
fun DdeQueryConvInfo = DdeQueryConvInfo(
hConv : Void*, # HCONV
idTransaction : UInt32, # DWORD
pConvInfo : CONVINFO* # CONVINFO* in/out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DdeQueryConvInfoNative = Uint32 Function(Pointer<Void>, Uint32, Pointer<Void>);
typedef DdeQueryConvInfoDart = int Function(Pointer<Void>, int, Pointer<Void>);
final DdeQueryConvInfo = DynamicLibrary.open('USER32.dll')
.lookupFunction<DdeQueryConvInfoNative, DdeQueryConvInfoDart>('DdeQueryConvInfo');
// hConv : HCONV -> Pointer<Void>
// idTransaction : DWORD -> Uint32
// pConvInfo : CONVINFO* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DdeQueryConvInfo(
hConv: THandle; // HCONV
idTransaction: DWORD; // DWORD
pConvInfo: Pointer // CONVINFO* in/out
): DWORD; stdcall;
external 'USER32.dll' name 'DdeQueryConvInfo';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DdeQueryConvInfo"
c_DdeQueryConvInfo :: Ptr () -> Word32 -> Ptr () -> IO Word32
-- hConv : HCONV -> Ptr ()
-- idTransaction : DWORD -> Word32
-- pConvInfo : CONVINFO* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ddequeryconvinfo =
foreign "DdeQueryConvInfo"
((ptr void) @-> uint32_t @-> (ptr void) @-> returning uint32_t)
(* hConv : HCONV -> (ptr void) *)
(* idTransaction : DWORD -> uint32_t *)
(* pConvInfo : CONVINFO* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library user32 (t "USER32.dll"))
(cffi:use-foreign-library user32)
(cffi:defcfun ("DdeQueryConvInfo" dde-query-conv-info :convention :stdcall) :uint32
(h-conv :pointer) ; HCONV
(id-transaction :uint32) ; DWORD
(p-conv-info :pointer)) ; CONVINFO* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DdeQueryConvInfo = Win32::API::More->new('USER32',
'DWORD DdeQueryConvInfo(HANDLE hConv, DWORD idTransaction, LPVOID pConvInfo)');
# my $ret = $DdeQueryConvInfo->Call($hConv, $idTransaction, $pConvInfo);
# hConv : HCONV -> HANDLE
# idTransaction : DWORD -> DWORD
# pConvInfo : CONVINFO* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f DdeClientTransaction — DDEクライアントがサーバーへデータ要求や送信を行う。
- f DdeConnect — 指定サービスとトピックでDDEサーバーとの会話を確立する。
- f DdeConnectList — 指定サービスとトピックに合致するDDE会話の一覧を確立する。
- f DdeKeepStringHandle — DDE文字列ハンドルの参照カウントを増やして保持する。
- f DdeQueryNextServer — DDE会話リストから次のサーバー会話ハンドルを取得する。
使用する型