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