Win32 API 日本語リファレンス
ホームNetworking.WindowsWebServices › WsCreateReader

WsCreateReader

関数
XMLリーダーを作成する。
DLLwebservices.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WsCreateReader(
    const WS_XML_READER_PROPERTY* properties,   // optional
    DWORD propertyCount,
    WS_XML_READER** reader,
    WS_ERROR* error   // optional
);

パラメーター

名前方向
propertiesWS_XML_READER_PROPERTY*inoptional
propertyCountDWORDin
readerWS_XML_READER**out
errorWS_ERROR*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WsCreateReader(
    const WS_XML_READER_PROPERTY* properties,   // optional
    DWORD propertyCount,
    WS_XML_READER** reader,
    WS_ERROR* error   // optional
);
[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsCreateReader(
    IntPtr properties,   // WS_XML_READER_PROPERTY* optional
    uint propertyCount,   // DWORD
    IntPtr reader,   // WS_XML_READER** out
    IntPtr error   // WS_ERROR* optional
);
<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsCreateReader(
    properties As IntPtr,   ' WS_XML_READER_PROPERTY* optional
    propertyCount As UInteger,   ' DWORD
    reader As IntPtr,   ' WS_XML_READER** out
    [error] As IntPtr   ' WS_ERROR* optional
) As Integer
End Function
' properties : WS_XML_READER_PROPERTY* optional
' propertyCount : DWORD
' reader : WS_XML_READER** out
' error : WS_ERROR* optional
Declare PtrSafe Function WsCreateReader Lib "webservices" ( _
    ByVal properties As LongPtr, _
    ByVal propertyCount As Long, _
    ByVal reader As LongPtr, _
    ByVal error As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WsCreateReader = ctypes.windll.webservices.WsCreateReader
WsCreateReader.restype = ctypes.c_int
WsCreateReader.argtypes = [
    ctypes.c_void_p,  # properties : WS_XML_READER_PROPERTY* optional
    wintypes.DWORD,  # propertyCount : DWORD
    ctypes.c_void_p,  # reader : WS_XML_READER** out
    ctypes.c_void_p,  # error : WS_ERROR* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('webservices.dll')
WsCreateReader = Fiddle::Function.new(
  lib['WsCreateReader'],
  [
    Fiddle::TYPE_VOIDP,  # properties : WS_XML_READER_PROPERTY* optional
    -Fiddle::TYPE_INT,  # propertyCount : DWORD
    Fiddle::TYPE_VOIDP,  # reader : WS_XML_READER** out
    Fiddle::TYPE_VOIDP,  # error : WS_ERROR* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "webservices")]
extern "system" {
    fn WsCreateReader(
        properties: *const WS_XML_READER_PROPERTY,  // WS_XML_READER_PROPERTY* optional
        propertyCount: u32,  // DWORD
        reader: *mut *mut isize,  // WS_XML_READER** out
        error: *mut isize  // WS_ERROR* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("webservices.dll")]
public static extern int WsCreateReader(IntPtr properties, uint propertyCount, IntPtr reader, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsCreateReader' -Namespace Win32 -PassThru
# $api::WsCreateReader(properties, propertyCount, reader, error)
#uselib "webservices.dll"
#func global WsCreateReader "WsCreateReader" sptr, sptr, sptr, sptr
; WsCreateReader varptr(properties), propertyCount, reader, error   ; 戻り値は stat
; properties : WS_XML_READER_PROPERTY* optional -> "sptr"
; propertyCount : DWORD -> "sptr"
; reader : WS_XML_READER** out -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "webservices.dll"
#cfunc global WsCreateReader "WsCreateReader" var, int, int, int
; res = WsCreateReader(properties, propertyCount, reader, error)
; properties : WS_XML_READER_PROPERTY* optional -> "var"
; propertyCount : DWORD -> "int"
; reader : WS_XML_READER** out -> "int"
; error : WS_ERROR* optional -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT WsCreateReader(WS_XML_READER_PROPERTY* properties, DWORD propertyCount, WS_XML_READER** reader, WS_ERROR* error)
#uselib "webservices.dll"
#cfunc global WsCreateReader "WsCreateReader" var, int, int, int
; res = WsCreateReader(properties, propertyCount, reader, error)
; properties : WS_XML_READER_PROPERTY* optional -> "var"
; propertyCount : DWORD -> "int"
; reader : WS_XML_READER** out -> "int"
; error : WS_ERROR* optional -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	webservices = windows.NewLazySystemDLL("webservices.dll")
	procWsCreateReader = webservices.NewProc("WsCreateReader")
)

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