ホーム › System.DataExchange › DdeNameService
DdeNameService
関数DDEサーバーのサービス名を登録または登録解除する。
シグネチャ
// USER32.dll
#include <windows.h>
HDDEDATA DdeNameService(
DWORD idInst,
HSZ hsz1, // optional
HSZ hsz2, // optional
DDE_NAME_SERVICE_CMD afCmd
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| idInst | DWORD | in |
| hsz1 | HSZ | inoptional |
| hsz2 | HSZ | inoptional |
| afCmd | DDE_NAME_SERVICE_CMD | in |
戻り値の型: HDDEDATA
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
HDDEDATA DdeNameService(
DWORD idInst,
HSZ hsz1, // optional
HSZ hsz2, // optional
DDE_NAME_SERVICE_CMD afCmd
);[DllImport("USER32.dll", ExactSpelling = true)]
static extern IntPtr DdeNameService(
uint idInst, // DWORD
IntPtr hsz1, // HSZ optional
IntPtr hsz2, // HSZ optional
uint afCmd // DDE_NAME_SERVICE_CMD
);<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function DdeNameService(
idInst As UInteger, ' DWORD
hsz1 As IntPtr, ' HSZ optional
hsz2 As IntPtr, ' HSZ optional
afCmd As UInteger ' DDE_NAME_SERVICE_CMD
) As IntPtr
End Function' idInst : DWORD
' hsz1 : HSZ optional
' hsz2 : HSZ optional
' afCmd : DDE_NAME_SERVICE_CMD
Declare PtrSafe Function DdeNameService Lib "user32" ( _
ByVal idInst As Long, _
ByVal hsz1 As LongPtr, _
ByVal hsz2 As LongPtr, _
ByVal afCmd As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DdeNameService = ctypes.windll.user32.DdeNameService
DdeNameService.restype = ctypes.c_void_p
DdeNameService.argtypes = [
wintypes.DWORD, # idInst : DWORD
wintypes.HANDLE, # hsz1 : HSZ optional
wintypes.HANDLE, # hsz2 : HSZ optional
wintypes.DWORD, # afCmd : DDE_NAME_SERVICE_CMD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
DdeNameService = Fiddle::Function.new(
lib['DdeNameService'],
[
-Fiddle::TYPE_INT, # idInst : DWORD
Fiddle::TYPE_VOIDP, # hsz1 : HSZ optional
Fiddle::TYPE_VOIDP, # hsz2 : HSZ optional
-Fiddle::TYPE_INT, # afCmd : DDE_NAME_SERVICE_CMD
],
Fiddle::TYPE_VOIDP)#[link(name = "user32")]
extern "system" {
fn DdeNameService(
idInst: u32, // DWORD
hsz1: *mut core::ffi::c_void, // HSZ optional
hsz2: *mut core::ffi::c_void, // HSZ optional
afCmd: u32 // DDE_NAME_SERVICE_CMD
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll")]
public static extern IntPtr DdeNameService(uint idInst, IntPtr hsz1, IntPtr hsz2, uint afCmd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DdeNameService' -Namespace Win32 -PassThru
# $api::DdeNameService(idInst, hsz1, hsz2, afCmd)#uselib "USER32.dll"
#func global DdeNameService "DdeNameService" sptr, sptr, sptr, sptr
; DdeNameService idInst, hsz1, hsz2, afCmd ; 戻り値は stat
; idInst : DWORD -> "sptr"
; hsz1 : HSZ optional -> "sptr"
; hsz2 : HSZ optional -> "sptr"
; afCmd : DDE_NAME_SERVICE_CMD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global DdeNameService "DdeNameService" int, sptr, sptr, int
; res = DdeNameService(idInst, hsz1, hsz2, afCmd)
; idInst : DWORD -> "int"
; hsz1 : HSZ optional -> "sptr"
; hsz2 : HSZ optional -> "sptr"
; afCmd : DDE_NAME_SERVICE_CMD -> "int"; HDDEDATA DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, DDE_NAME_SERVICE_CMD afCmd)
#uselib "USER32.dll"
#cfunc global DdeNameService "DdeNameService" int, intptr, intptr, int
; res = DdeNameService(idInst, hsz1, hsz2, afCmd)
; idInst : DWORD -> "int"
; hsz1 : HSZ optional -> "intptr"
; hsz2 : HSZ optional -> "intptr"
; afCmd : DDE_NAME_SERVICE_CMD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procDdeNameService = user32.NewProc("DdeNameService")
)
// idInst (DWORD), hsz1 (HSZ optional), hsz2 (HSZ optional), afCmd (DDE_NAME_SERVICE_CMD)
r1, _, err := procDdeNameService.Call(
uintptr(idInst),
uintptr(hsz1),
uintptr(hsz2),
uintptr(afCmd),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HDDEDATAfunction DdeNameService(
idInst: DWORD; // DWORD
hsz1: THandle; // HSZ optional
hsz2: THandle; // HSZ optional
afCmd: DWORD // DDE_NAME_SERVICE_CMD
): THandle; stdcall;
external 'USER32.dll' name 'DdeNameService';result := DllCall("USER32\DdeNameService"
, "UInt", idInst ; DWORD
, "Ptr", hsz1 ; HSZ optional
, "Ptr", hsz2 ; HSZ optional
, "UInt", afCmd ; DDE_NAME_SERVICE_CMD
, "Ptr") ; return: HDDEDATA●DdeNameService(idInst, hsz1, hsz2, afCmd) = DLL("USER32.dll", "void* DdeNameService(dword, void*, void*, dword)")
# 呼び出し: DdeNameService(idInst, hsz1, hsz2, afCmd)
# idInst : DWORD -> "dword"
# hsz1 : HSZ optional -> "void*"
# hsz2 : HSZ optional -> "void*"
# afCmd : DDE_NAME_SERVICE_CMD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。