Win32 API 日本語リファレンス
ホームDevices.WebServicesOnDevices › WSDCreateUdpAddress

WSDCreateUdpAddress

関数
WSD用のUDPアドレスオブジェクトを作成する。
DLLwsdapi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT WSDCreateUdpAddress(
    IWSDUdpAddress** ppAddress
);

パラメーター

名前方向説明
ppAddressIWSDUdpAddress**out作成したIWSDUdpAddressオブジェクトを受け取る出力先ポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WSDCreateUdpAddress(
    IWSDUdpAddress** ppAddress
);
[DllImport("wsdapi.dll", ExactSpelling = true)]
static extern int WSDCreateUdpAddress(
    IntPtr ppAddress   // IWSDUdpAddress** out
);
<DllImport("wsdapi.dll", ExactSpelling:=True)>
Public Shared Function WSDCreateUdpAddress(
    ppAddress As IntPtr   ' IWSDUdpAddress** out
) As Integer
End Function
' ppAddress : IWSDUdpAddress** out
Declare PtrSafe Function WSDCreateUdpAddress Lib "wsdapi" ( _
    ByVal ppAddress As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WSDCreateUdpAddress = ctypes.windll.wsdapi.WSDCreateUdpAddress
WSDCreateUdpAddress.restype = ctypes.c_int
WSDCreateUdpAddress.argtypes = [
    ctypes.c_void_p,  # ppAddress : IWSDUdpAddress** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wsdapi.dll')
WSDCreateUdpAddress = Fiddle::Function.new(
  lib['WSDCreateUdpAddress'],
  [
    Fiddle::TYPE_VOIDP,  # ppAddress : IWSDUdpAddress** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "wsdapi")]
extern "system" {
    fn WSDCreateUdpAddress(
        ppAddress: *mut *mut core::ffi::c_void  // IWSDUdpAddress** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wsdapi.dll")]
public static extern int WSDCreateUdpAddress(IntPtr ppAddress);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsdapi_WSDCreateUdpAddress' -Namespace Win32 -PassThru
# $api::WSDCreateUdpAddress(ppAddress)
#uselib "wsdapi.dll"
#func global WSDCreateUdpAddress "WSDCreateUdpAddress" sptr
; WSDCreateUdpAddress ppAddress   ; 戻り値は stat
; ppAddress : IWSDUdpAddress** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "wsdapi.dll"
#cfunc global WSDCreateUdpAddress "WSDCreateUdpAddress" sptr
; res = WSDCreateUdpAddress(ppAddress)
; ppAddress : IWSDUdpAddress** out -> "sptr"
; HRESULT WSDCreateUdpAddress(IWSDUdpAddress** ppAddress)
#uselib "wsdapi.dll"
#cfunc global WSDCreateUdpAddress "WSDCreateUdpAddress" intptr
; res = WSDCreateUdpAddress(ppAddress)
; ppAddress : IWSDUdpAddress** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wsdapi = windows.NewLazySystemDLL("wsdapi.dll")
	procWSDCreateUdpAddress = wsdapi.NewProc("WSDCreateUdpAddress")
)

// ppAddress (IWSDUdpAddress** out)
r1, _, err := procWSDCreateUdpAddress.Call(
	uintptr(ppAddress),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WSDCreateUdpAddress(
  ppAddress: Pointer   // IWSDUdpAddress** out
): Integer; stdcall;
  external 'wsdapi.dll' name 'WSDCreateUdpAddress';
result := DllCall("wsdapi\WSDCreateUdpAddress"
    , "Ptr", ppAddress   ; IWSDUdpAddress** out
    , "Int")   ; return: HRESULT
●WSDCreateUdpAddress(ppAddress) = DLL("wsdapi.dll", "int WSDCreateUdpAddress(void*)")
# 呼び出し: WSDCreateUdpAddress(ppAddress)
# ppAddress : IWSDUdpAddress** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。