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

WsInitializeMessage

関数
メッセージを指定方法で初期化する。
DLLwebservices.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WsInitializeMessage(
    WS_MESSAGE* message,
    WS_MESSAGE_INITIALIZATION initialization,
    WS_MESSAGE* sourceMessage,   // optional
    WS_ERROR* error   // optional
);

パラメーター

名前方向
messageWS_MESSAGE*in
initializationWS_MESSAGE_INITIALIZATIONin
sourceMessageWS_MESSAGE*inoptional
errorWS_ERROR*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WsInitializeMessage(
    WS_MESSAGE* message,
    WS_MESSAGE_INITIALIZATION initialization,
    WS_MESSAGE* sourceMessage,   // optional
    WS_ERROR* error   // optional
);
[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsInitializeMessage(
    ref IntPtr message,   // WS_MESSAGE*
    int initialization,   // WS_MESSAGE_INITIALIZATION
    IntPtr sourceMessage,   // WS_MESSAGE* optional
    IntPtr error   // WS_ERROR* optional
);
<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsInitializeMessage(
    ByRef message As IntPtr,   ' WS_MESSAGE*
    initialization As Integer,   ' WS_MESSAGE_INITIALIZATION
    sourceMessage As IntPtr,   ' WS_MESSAGE* optional
    [error] As IntPtr   ' WS_ERROR* optional
) As Integer
End Function
' message : WS_MESSAGE*
' initialization : WS_MESSAGE_INITIALIZATION
' sourceMessage : WS_MESSAGE* optional
' error : WS_ERROR* optional
Declare PtrSafe Function WsInitializeMessage Lib "webservices" ( _
    ByRef message As LongPtr, _
    ByVal initialization As Long, _
    ByVal sourceMessage 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

WsInitializeMessage = ctypes.windll.webservices.WsInitializeMessage
WsInitializeMessage.restype = ctypes.c_int
WsInitializeMessage.argtypes = [
    ctypes.c_void_p,  # message : WS_MESSAGE*
    ctypes.c_int,  # initialization : WS_MESSAGE_INITIALIZATION
    ctypes.c_void_p,  # sourceMessage : WS_MESSAGE* optional
    ctypes.c_void_p,  # error : WS_ERROR* optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	webservices = windows.NewLazySystemDLL("webservices.dll")
	procWsInitializeMessage = webservices.NewProc("WsInitializeMessage")
)

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