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