ホーム › Devices.WebServicesOnDevices › WSDCreateDiscoveryPublisher
WSDCreateDiscoveryPublisher
関数WSDで自デバイスを公告するディスカバリパブリッシャを作成する。
シグネチャ
// wsdapi.dll
#include <windows.h>
HRESULT WSDCreateDiscoveryPublisher(
IWSDXMLContext* pContext,
IWSDiscoveryPublisher** ppPublisher
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pContext | IWSDXMLContext* | in | XML処理に用いるIWSDXMLContextへのポインタ。NULL可で既定を使う。 |
| ppPublisher | IWSDiscoveryPublisher** | out | 作成したIWSDiscoveryPublisherオブジェクトを受け取る出力先ポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// wsdapi.dll
#include <windows.h>
HRESULT WSDCreateDiscoveryPublisher(
IWSDXMLContext* pContext,
IWSDiscoveryPublisher** ppPublisher
);[DllImport("wsdapi.dll", ExactSpelling = true)]
static extern int WSDCreateDiscoveryPublisher(
IntPtr pContext, // IWSDXMLContext*
IntPtr ppPublisher // IWSDiscoveryPublisher** out
);<DllImport("wsdapi.dll", ExactSpelling:=True)>
Public Shared Function WSDCreateDiscoveryPublisher(
pContext As IntPtr, ' IWSDXMLContext*
ppPublisher As IntPtr ' IWSDiscoveryPublisher** out
) As Integer
End Function' pContext : IWSDXMLContext*
' ppPublisher : IWSDiscoveryPublisher** out
Declare PtrSafe Function WSDCreateDiscoveryPublisher Lib "wsdapi" ( _
ByVal pContext As LongPtr, _
ByVal ppPublisher As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WSDCreateDiscoveryPublisher = ctypes.windll.wsdapi.WSDCreateDiscoveryPublisher
WSDCreateDiscoveryPublisher.restype = ctypes.c_int
WSDCreateDiscoveryPublisher.argtypes = [
ctypes.c_void_p, # pContext : IWSDXMLContext*
ctypes.c_void_p, # ppPublisher : IWSDiscoveryPublisher** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wsdapi.dll')
WSDCreateDiscoveryPublisher = Fiddle::Function.new(
lib['WSDCreateDiscoveryPublisher'],
[
Fiddle::TYPE_VOIDP, # pContext : IWSDXMLContext*
Fiddle::TYPE_VOIDP, # ppPublisher : IWSDiscoveryPublisher** out
],
Fiddle::TYPE_INT)#[link(name = "wsdapi")]
extern "system" {
fn WSDCreateDiscoveryPublisher(
pContext: *mut core::ffi::c_void, // IWSDXMLContext*
ppPublisher: *mut *mut core::ffi::c_void // IWSDiscoveryPublisher** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wsdapi.dll")]
public static extern int WSDCreateDiscoveryPublisher(IntPtr pContext, IntPtr ppPublisher);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsdapi_WSDCreateDiscoveryPublisher' -Namespace Win32 -PassThru
# $api::WSDCreateDiscoveryPublisher(pContext, ppPublisher)#uselib "wsdapi.dll"
#func global WSDCreateDiscoveryPublisher "WSDCreateDiscoveryPublisher" sptr, sptr
; WSDCreateDiscoveryPublisher pContext, ppPublisher ; 戻り値は stat
; pContext : IWSDXMLContext* -> "sptr"
; ppPublisher : IWSDiscoveryPublisher** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "wsdapi.dll"
#cfunc global WSDCreateDiscoveryPublisher "WSDCreateDiscoveryPublisher" sptr, sptr
; res = WSDCreateDiscoveryPublisher(pContext, ppPublisher)
; pContext : IWSDXMLContext* -> "sptr"
; ppPublisher : IWSDiscoveryPublisher** out -> "sptr"; HRESULT WSDCreateDiscoveryPublisher(IWSDXMLContext* pContext, IWSDiscoveryPublisher** ppPublisher)
#uselib "wsdapi.dll"
#cfunc global WSDCreateDiscoveryPublisher "WSDCreateDiscoveryPublisher" intptr, intptr
; res = WSDCreateDiscoveryPublisher(pContext, ppPublisher)
; pContext : IWSDXMLContext* -> "intptr"
; ppPublisher : IWSDiscoveryPublisher** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wsdapi = windows.NewLazySystemDLL("wsdapi.dll")
procWSDCreateDiscoveryPublisher = wsdapi.NewProc("WSDCreateDiscoveryPublisher")
)
// pContext (IWSDXMLContext*), ppPublisher (IWSDiscoveryPublisher** out)
r1, _, err := procWSDCreateDiscoveryPublisher.Call(
uintptr(pContext),
uintptr(ppPublisher),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WSDCreateDiscoveryPublisher(
pContext: Pointer; // IWSDXMLContext*
ppPublisher: Pointer // IWSDiscoveryPublisher** out
): Integer; stdcall;
external 'wsdapi.dll' name 'WSDCreateDiscoveryPublisher';result := DllCall("wsdapi\WSDCreateDiscoveryPublisher"
, "Ptr", pContext ; IWSDXMLContext*
, "Ptr", ppPublisher ; IWSDiscoveryPublisher** out
, "Int") ; return: HRESULT●WSDCreateDiscoveryPublisher(pContext, ppPublisher) = DLL("wsdapi.dll", "int WSDCreateDiscoveryPublisher(void*, void*)")
# 呼び出し: WSDCreateDiscoveryPublisher(pContext, ppPublisher)
# pContext : IWSDXMLContext* -> "void*"
# ppPublisher : IWSDiscoveryPublisher** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。