ホーム › Networking.WindowsWebServices › WsFindAttribute
WsFindAttribute
関数指定名のXML属性のインデックスを検索する。
シグネチャ
// webservices.dll
#include <windows.h>
HRESULT WsFindAttribute(
WS_XML_READER* reader,
const WS_XML_STRING* localName,
const WS_XML_STRING* ns,
BOOL required,
DWORD* attributeIndex,
WS_ERROR* error // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| reader | WS_XML_READER* | in |
| localName | WS_XML_STRING* | in |
| ns | WS_XML_STRING* | in |
| required | BOOL | in |
| attributeIndex | DWORD* | out |
| error | WS_ERROR* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// webservices.dll
#include <windows.h>
HRESULT WsFindAttribute(
WS_XML_READER* reader,
const WS_XML_STRING* localName,
const WS_XML_STRING* ns,
BOOL required,
DWORD* attributeIndex,
WS_ERROR* error // optional
);[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsFindAttribute(
ref IntPtr reader, // WS_XML_READER*
IntPtr localName, // WS_XML_STRING*
IntPtr ns, // WS_XML_STRING*
bool required, // BOOL
out uint attributeIndex, // DWORD* out
IntPtr error // WS_ERROR* optional
);<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsFindAttribute(
ByRef reader As IntPtr, ' WS_XML_READER*
localName As IntPtr, ' WS_XML_STRING*
ns As IntPtr, ' WS_XML_STRING*
required As Boolean, ' BOOL
<Out> ByRef attributeIndex As UInteger, ' DWORD* out
[error] As IntPtr ' WS_ERROR* optional
) As Integer
End Function' reader : WS_XML_READER*
' localName : WS_XML_STRING*
' ns : WS_XML_STRING*
' required : BOOL
' attributeIndex : DWORD* out
' error : WS_ERROR* optional
Declare PtrSafe Function WsFindAttribute Lib "webservices" ( _
ByRef reader As LongPtr, _
ByVal localName As LongPtr, _
ByVal ns As LongPtr, _
ByVal required As Long, _
ByRef attributeIndex 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
WsFindAttribute = ctypes.windll.webservices.WsFindAttribute
WsFindAttribute.restype = ctypes.c_int
WsFindAttribute.argtypes = [
ctypes.c_void_p, # reader : WS_XML_READER*
ctypes.c_void_p, # localName : WS_XML_STRING*
ctypes.c_void_p, # ns : WS_XML_STRING*
wintypes.BOOL, # required : BOOL
ctypes.POINTER(wintypes.DWORD), # attributeIndex : DWORD* out
ctypes.c_void_p, # error : WS_ERROR* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('webservices.dll')
WsFindAttribute = Fiddle::Function.new(
lib['WsFindAttribute'],
[
Fiddle::TYPE_VOIDP, # reader : WS_XML_READER*
Fiddle::TYPE_VOIDP, # localName : WS_XML_STRING*
Fiddle::TYPE_VOIDP, # ns : WS_XML_STRING*
Fiddle::TYPE_INT, # required : BOOL
Fiddle::TYPE_VOIDP, # attributeIndex : DWORD* out
Fiddle::TYPE_VOIDP, # error : WS_ERROR* optional
],
Fiddle::TYPE_INT)#[link(name = "webservices")]
extern "system" {
fn WsFindAttribute(
reader: *mut isize, // WS_XML_READER*
localName: *const WS_XML_STRING, // WS_XML_STRING*
ns: *const WS_XML_STRING, // WS_XML_STRING*
required: i32, // BOOL
attributeIndex: *mut u32, // DWORD* 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 WsFindAttribute(ref IntPtr reader, IntPtr localName, IntPtr ns, bool required, out uint attributeIndex, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsFindAttribute' -Namespace Win32 -PassThru
# $api::WsFindAttribute(reader, localName, ns, required, attributeIndex, error)#uselib "webservices.dll"
#func global WsFindAttribute "WsFindAttribute" sptr, sptr, sptr, sptr, sptr, sptr
; WsFindAttribute reader, varptr(localName), varptr(ns), required, varptr(attributeIndex), error ; 戻り値は stat
; reader : WS_XML_READER* -> "sptr"
; localName : WS_XML_STRING* -> "sptr"
; ns : WS_XML_STRING* -> "sptr"
; required : BOOL -> "sptr"
; attributeIndex : DWORD* out -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "webservices.dll" #cfunc global WsFindAttribute "WsFindAttribute" int, var, var, int, var, int ; res = WsFindAttribute(reader, localName, ns, required, attributeIndex, error) ; reader : WS_XML_READER* -> "int" ; localName : WS_XML_STRING* -> "var" ; ns : WS_XML_STRING* -> "var" ; required : BOOL -> "int" ; attributeIndex : DWORD* out -> "var" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "webservices.dll" #cfunc global WsFindAttribute "WsFindAttribute" int, sptr, sptr, int, sptr, int ; res = WsFindAttribute(reader, varptr(localName), varptr(ns), required, varptr(attributeIndex), error) ; reader : WS_XML_READER* -> "int" ; localName : WS_XML_STRING* -> "sptr" ; ns : WS_XML_STRING* -> "sptr" ; required : BOOL -> "int" ; attributeIndex : DWORD* out -> "sptr" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WsFindAttribute(WS_XML_READER* reader, WS_XML_STRING* localName, WS_XML_STRING* ns, BOOL required, DWORD* attributeIndex, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsFindAttribute "WsFindAttribute" int, var, var, int, var, int ; res = WsFindAttribute(reader, localName, ns, required, attributeIndex, error) ; reader : WS_XML_READER* -> "int" ; localName : WS_XML_STRING* -> "var" ; ns : WS_XML_STRING* -> "var" ; required : BOOL -> "int" ; attributeIndex : DWORD* out -> "var" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WsFindAttribute(WS_XML_READER* reader, WS_XML_STRING* localName, WS_XML_STRING* ns, BOOL required, DWORD* attributeIndex, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsFindAttribute "WsFindAttribute" int, intptr, intptr, int, intptr, int ; res = WsFindAttribute(reader, varptr(localName), varptr(ns), required, varptr(attributeIndex), error) ; reader : WS_XML_READER* -> "int" ; localName : WS_XML_STRING* -> "intptr" ; ns : WS_XML_STRING* -> "intptr" ; required : BOOL -> "int" ; attributeIndex : DWORD* out -> "intptr" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
webservices = windows.NewLazySystemDLL("webservices.dll")
procWsFindAttribute = webservices.NewProc("WsFindAttribute")
)
// reader (WS_XML_READER*), localName (WS_XML_STRING*), ns (WS_XML_STRING*), required (BOOL), attributeIndex (DWORD* out), error (WS_ERROR* optional)
r1, _, err := procWsFindAttribute.Call(
uintptr(reader),
uintptr(localName),
uintptr(ns),
uintptr(required),
uintptr(attributeIndex),
uintptr(error),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WsFindAttribute(
reader: Pointer; // WS_XML_READER*
localName: Pointer; // WS_XML_STRING*
ns: Pointer; // WS_XML_STRING*
required: BOOL; // BOOL
attributeIndex: Pointer; // DWORD* out
error: Pointer // WS_ERROR* optional
): Integer; stdcall;
external 'webservices.dll' name 'WsFindAttribute';result := DllCall("webservices\WsFindAttribute"
, "Ptr", reader ; WS_XML_READER*
, "Ptr", localName ; WS_XML_STRING*
, "Ptr", ns ; WS_XML_STRING*
, "Int", required ; BOOL
, "Ptr", attributeIndex ; DWORD* out
, "Ptr", error ; WS_ERROR* optional
, "Int") ; return: HRESULT●WsFindAttribute(reader, localName, ns, required, attributeIndex, error) = DLL("webservices.dll", "int WsFindAttribute(void*, void*, void*, bool, void*, void*)")
# 呼び出し: WsFindAttribute(reader, localName, ns, required, attributeIndex, error)
# reader : WS_XML_READER* -> "void*"
# localName : WS_XML_STRING* -> "void*"
# ns : WS_XML_STRING* -> "void*"
# required : BOOL -> "bool"
# attributeIndex : DWORD* out -> "void*"
# error : WS_ERROR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。