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

DdeEnableCallback

関数
DDEトランザクションのコールバックを有効化または無効化する。
DLLUSER32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// USER32.dll
#include <windows.h>

BOOL DdeEnableCallback(
    DWORD idInst,
    HCONV hConv,
    DDE_ENABLE_CALLBACK_CMD wCmd
);

パラメーター

名前方向
idInstDWORDin
hConvHCONVin
wCmdDDE_ENABLE_CALLBACK_CMDin

戻り値の型: BOOL

各言語での呼び出し定義

// USER32.dll
#include <windows.h>

BOOL DdeEnableCallback(
    DWORD idInst,
    HCONV hConv,
    DDE_ENABLE_CALLBACK_CMD wCmd
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool DdeEnableCallback(
    uint idInst,   // DWORD
    IntPtr hConv,   // HCONV
    uint wCmd   // DDE_ENABLE_CALLBACK_CMD
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function DdeEnableCallback(
    idInst As UInteger,   ' DWORD
    hConv As IntPtr,   ' HCONV
    wCmd As UInteger   ' DDE_ENABLE_CALLBACK_CMD
) As Boolean
End Function
' idInst : DWORD
' hConv : HCONV
' wCmd : DDE_ENABLE_CALLBACK_CMD
Declare PtrSafe Function DdeEnableCallback Lib "user32" ( _
    ByVal idInst As Long, _
    ByVal hConv As LongPtr, _
    ByVal wCmd As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DdeEnableCallback = ctypes.windll.user32.DdeEnableCallback
DdeEnableCallback.restype = wintypes.BOOL
DdeEnableCallback.argtypes = [
    wintypes.DWORD,  # idInst : DWORD
    wintypes.HANDLE,  # hConv : HCONV
    wintypes.DWORD,  # wCmd : DDE_ENABLE_CALLBACK_CMD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
DdeEnableCallback = Fiddle::Function.new(
  lib['DdeEnableCallback'],
  [
    -Fiddle::TYPE_INT,  # idInst : DWORD
    Fiddle::TYPE_VOIDP,  # hConv : HCONV
    -Fiddle::TYPE_INT,  # wCmd : DDE_ENABLE_CALLBACK_CMD
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn DdeEnableCallback(
        idInst: u32,  // DWORD
        hConv: *mut core::ffi::c_void,  // HCONV
        wCmd: u32  // DDE_ENABLE_CALLBACK_CMD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool DdeEnableCallback(uint idInst, IntPtr hConv, uint wCmd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DdeEnableCallback' -Namespace Win32 -PassThru
# $api::DdeEnableCallback(idInst, hConv, wCmd)
#uselib "USER32.dll"
#func global DdeEnableCallback "DdeEnableCallback" sptr, sptr, sptr
; DdeEnableCallback idInst, hConv, wCmd   ; 戻り値は stat
; idInst : DWORD -> "sptr"
; hConv : HCONV -> "sptr"
; wCmd : DDE_ENABLE_CALLBACK_CMD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global DdeEnableCallback "DdeEnableCallback" int, sptr, int
; res = DdeEnableCallback(idInst, hConv, wCmd)
; idInst : DWORD -> "int"
; hConv : HCONV -> "sptr"
; wCmd : DDE_ENABLE_CALLBACK_CMD -> "int"
; BOOL DdeEnableCallback(DWORD idInst, HCONV hConv, DDE_ENABLE_CALLBACK_CMD wCmd)
#uselib "USER32.dll"
#cfunc global DdeEnableCallback "DdeEnableCallback" int, intptr, int
; res = DdeEnableCallback(idInst, hConv, wCmd)
; idInst : DWORD -> "int"
; hConv : HCONV -> "intptr"
; wCmd : DDE_ENABLE_CALLBACK_CMD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procDdeEnableCallback = user32.NewProc("DdeEnableCallback")
)

// idInst (DWORD), hConv (HCONV), wCmd (DDE_ENABLE_CALLBACK_CMD)
r1, _, err := procDdeEnableCallback.Call(
	uintptr(idInst),
	uintptr(hConv),
	uintptr(wCmd),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function DdeEnableCallback(
  idInst: DWORD;   // DWORD
  hConv: THandle;   // HCONV
  wCmd: DWORD   // DDE_ENABLE_CALLBACK_CMD
): BOOL; stdcall;
  external 'USER32.dll' name 'DdeEnableCallback';
result := DllCall("USER32\DdeEnableCallback"
    , "UInt", idInst   ; DWORD
    , "Ptr", hConv   ; HCONV
    , "UInt", wCmd   ; DDE_ENABLE_CALLBACK_CMD
    , "Int")   ; return: BOOL
●DdeEnableCallback(idInst, hConv, wCmd) = DLL("USER32.dll", "bool DdeEnableCallback(dword, void*, dword)")
# 呼び出し: DdeEnableCallback(idInst, hConv, wCmd)
# idInst : DWORD -> "dword"
# hConv : HCONV -> "void*"
# wCmd : DDE_ENABLE_CALLBACK_CMD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。