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

WsGetWriterProperty

関数
XMLライターのプロパティ値を取得する。
DLLwebservices.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WsGetWriterProperty(
    WS_XML_WRITER* writer,
    WS_XML_WRITER_PROPERTY_ID id,
    void* value,
    DWORD valueSize,
    WS_ERROR* error   // optional
);

パラメーター

名前方向
writerWS_XML_WRITER*in
idWS_XML_WRITER_PROPERTY_IDin
valuevoid*out
valueSizeDWORDin
errorWS_ERROR*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WsGetWriterProperty(
    WS_XML_WRITER* writer,
    WS_XML_WRITER_PROPERTY_ID id,
    void* value,
    DWORD valueSize,
    WS_ERROR* error   // optional
);
[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsGetWriterProperty(
    ref IntPtr writer,   // WS_XML_WRITER*
    int id,   // WS_XML_WRITER_PROPERTY_ID
    IntPtr value,   // void* out
    uint valueSize,   // DWORD
    IntPtr error   // WS_ERROR* optional
);
<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsGetWriterProperty(
    ByRef writer As IntPtr,   ' WS_XML_WRITER*
    id As Integer,   ' WS_XML_WRITER_PROPERTY_ID
    value As IntPtr,   ' void* out
    valueSize As UInteger,   ' DWORD
    [error] As IntPtr   ' WS_ERROR* optional
) As Integer
End Function
' writer : WS_XML_WRITER*
' id : WS_XML_WRITER_PROPERTY_ID
' value : void* out
' valueSize : DWORD
' error : WS_ERROR* optional
Declare PtrSafe Function WsGetWriterProperty Lib "webservices" ( _
    ByRef writer As LongPtr, _
    ByVal id As Long, _
    ByVal value As LongPtr, _
    ByVal valueSize As Long, _
    ByVal error As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WsGetWriterProperty = ctypes.windll.webservices.WsGetWriterProperty
WsGetWriterProperty.restype = ctypes.c_int
WsGetWriterProperty.argtypes = [
    ctypes.c_void_p,  # writer : WS_XML_WRITER*
    ctypes.c_int,  # id : WS_XML_WRITER_PROPERTY_ID
    ctypes.POINTER(None),  # value : void* out
    wintypes.DWORD,  # valueSize : DWORD
    ctypes.c_void_p,  # error : WS_ERROR* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('webservices.dll')
WsGetWriterProperty = Fiddle::Function.new(
  lib['WsGetWriterProperty'],
  [
    Fiddle::TYPE_VOIDP,  # writer : WS_XML_WRITER*
    Fiddle::TYPE_INT,  # id : WS_XML_WRITER_PROPERTY_ID
    Fiddle::TYPE_VOIDP,  # value : void* out
    -Fiddle::TYPE_INT,  # valueSize : DWORD
    Fiddle::TYPE_VOIDP,  # error : WS_ERROR* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "webservices")]
extern "system" {
    fn WsGetWriterProperty(
        writer: *mut isize,  // WS_XML_WRITER*
        id: i32,  // WS_XML_WRITER_PROPERTY_ID
        value: *mut (),  // void* out
        valueSize: u32,  // DWORD
        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 WsGetWriterProperty(ref IntPtr writer, int id, IntPtr value, uint valueSize, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsGetWriterProperty' -Namespace Win32 -PassThru
# $api::WsGetWriterProperty(writer, id, value, valueSize, error)
#uselib "webservices.dll"
#func global WsGetWriterProperty "WsGetWriterProperty" sptr, sptr, sptr, sptr, sptr
; WsGetWriterProperty writer, id, value, valueSize, error   ; 戻り値は stat
; writer : WS_XML_WRITER* -> "sptr"
; id : WS_XML_WRITER_PROPERTY_ID -> "sptr"
; value : void* out -> "sptr"
; valueSize : DWORD -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "webservices.dll"
#cfunc global WsGetWriterProperty "WsGetWriterProperty" int, int, sptr, int, int
; res = WsGetWriterProperty(writer, id, value, valueSize, error)
; writer : WS_XML_WRITER* -> "int"
; id : WS_XML_WRITER_PROPERTY_ID -> "int"
; value : void* out -> "sptr"
; valueSize : DWORD -> "int"
; error : WS_ERROR* optional -> "int"
; HRESULT WsGetWriterProperty(WS_XML_WRITER* writer, WS_XML_WRITER_PROPERTY_ID id, void* value, DWORD valueSize, WS_ERROR* error)
#uselib "webservices.dll"
#cfunc global WsGetWriterProperty "WsGetWriterProperty" int, int, intptr, int, int
; res = WsGetWriterProperty(writer, id, value, valueSize, error)
; writer : WS_XML_WRITER* -> "int"
; id : WS_XML_WRITER_PROPERTY_ID -> "int"
; value : void* out -> "intptr"
; valueSize : DWORD -> "int"
; error : WS_ERROR* optional -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	webservices = windows.NewLazySystemDLL("webservices.dll")
	procWsGetWriterProperty = webservices.NewProc("WsGetWriterProperty")
)

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