ホーム › Networking.WindowsWebServices › WsCreateMessageForChannel
WsCreateMessageForChannel
関数チャネルに適合したメッセージを作成する。
シグネチャ
// webservices.dll
#include <windows.h>
HRESULT WsCreateMessageForChannel(
WS_CHANNEL* channel,
const WS_MESSAGE_PROPERTY* properties, // optional
DWORD propertyCount,
WS_MESSAGE** message,
WS_ERROR* error // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| channel | WS_CHANNEL* | in |
| properties | WS_MESSAGE_PROPERTY* | inoptional |
| propertyCount | DWORD | in |
| message | WS_MESSAGE** | out |
| error | WS_ERROR* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// webservices.dll
#include <windows.h>
HRESULT WsCreateMessageForChannel(
WS_CHANNEL* channel,
const WS_MESSAGE_PROPERTY* properties, // optional
DWORD propertyCount,
WS_MESSAGE** message,
WS_ERROR* error // optional
);[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsCreateMessageForChannel(
ref IntPtr channel, // WS_CHANNEL*
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 WsCreateMessageForChannel(
ByRef channel As IntPtr, ' WS_CHANNEL*
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' channel : WS_CHANNEL*
' properties : WS_MESSAGE_PROPERTY* optional
' propertyCount : DWORD
' message : WS_MESSAGE** out
' error : WS_ERROR* optional
Declare PtrSafe Function WsCreateMessageForChannel Lib "webservices" ( _
ByRef channel As LongPtr, _
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
WsCreateMessageForChannel = ctypes.windll.webservices.WsCreateMessageForChannel
WsCreateMessageForChannel.restype = ctypes.c_int
WsCreateMessageForChannel.argtypes = [
ctypes.c_void_p, # channel : WS_CHANNEL*
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')
WsCreateMessageForChannel = Fiddle::Function.new(
lib['WsCreateMessageForChannel'],
[
Fiddle::TYPE_VOIDP, # channel : WS_CHANNEL*
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 WsCreateMessageForChannel(
channel: *mut isize, // WS_CHANNEL*
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 WsCreateMessageForChannel(ref IntPtr channel, IntPtr properties, uint propertyCount, IntPtr message, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsCreateMessageForChannel' -Namespace Win32 -PassThru
# $api::WsCreateMessageForChannel(channel, properties, propertyCount, message, error)#uselib "webservices.dll"
#func global WsCreateMessageForChannel "WsCreateMessageForChannel" sptr, sptr, sptr, sptr, sptr
; WsCreateMessageForChannel channel, varptr(properties), propertyCount, message, error ; 戻り値は stat
; channel : WS_CHANNEL* -> "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 WsCreateMessageForChannel "WsCreateMessageForChannel" int, var, int, int, int ; res = WsCreateMessageForChannel(channel, properties, propertyCount, message, error) ; channel : WS_CHANNEL* -> "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 WsCreateMessageForChannel "WsCreateMessageForChannel" int, sptr, int, int, int ; res = WsCreateMessageForChannel(channel, varptr(properties), propertyCount, message, error) ; channel : WS_CHANNEL* -> "int" ; properties : WS_MESSAGE_PROPERTY* optional -> "sptr" ; propertyCount : DWORD -> "int" ; message : WS_MESSAGE** out -> "int" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WsCreateMessageForChannel(WS_CHANNEL* channel, WS_MESSAGE_PROPERTY* properties, DWORD propertyCount, WS_MESSAGE** message, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsCreateMessageForChannel "WsCreateMessageForChannel" int, var, int, int, int ; res = WsCreateMessageForChannel(channel, properties, propertyCount, message, error) ; channel : WS_CHANNEL* -> "int" ; properties : WS_MESSAGE_PROPERTY* optional -> "var" ; propertyCount : DWORD -> "int" ; message : WS_MESSAGE** out -> "int" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WsCreateMessageForChannel(WS_CHANNEL* channel, WS_MESSAGE_PROPERTY* properties, DWORD propertyCount, WS_MESSAGE** message, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsCreateMessageForChannel "WsCreateMessageForChannel" int, intptr, int, int, int ; res = WsCreateMessageForChannel(channel, varptr(properties), propertyCount, message, error) ; channel : WS_CHANNEL* -> "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")
procWsCreateMessageForChannel = webservices.NewProc("WsCreateMessageForChannel")
)
// channel (WS_CHANNEL*), properties (WS_MESSAGE_PROPERTY* optional), propertyCount (DWORD), message (WS_MESSAGE** out), error (WS_ERROR* optional)
r1, _, err := procWsCreateMessageForChannel.Call(
uintptr(channel),
uintptr(properties),
uintptr(propertyCount),
uintptr(message),
uintptr(error),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WsCreateMessageForChannel(
channel: Pointer; // WS_CHANNEL*
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 'WsCreateMessageForChannel';result := DllCall("webservices\WsCreateMessageForChannel"
, "Ptr", channel ; WS_CHANNEL*
, "Ptr", properties ; WS_MESSAGE_PROPERTY* optional
, "UInt", propertyCount ; DWORD
, "Ptr", message ; WS_MESSAGE** out
, "Ptr", error ; WS_ERROR* optional
, "Int") ; return: HRESULT●WsCreateMessageForChannel(channel, properties, propertyCount, message, error) = DLL("webservices.dll", "int WsCreateMessageForChannel(void*, void*, dword, void*, void*)")
# 呼び出し: WsCreateMessageForChannel(channel, properties, propertyCount, message, error)
# channel : WS_CHANNEL* -> "void*"
# 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)。