Win32 API 日本語リファレンス
ホームDevices.AllJoyn › AllJoynSendToBus

AllJoynSendToBus

関数
AllJoynバスへデータを送信する。
DLLMSAJApi.dll呼出規約winapiSetLastErrorあり対応OSWindows 10 以降

シグネチャ

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

BOOL AllJoynSendToBus(
    HANDLE connectedBusHandle,
    const void* buffer,   // optional
    DWORD bytesToWrite,
    DWORD* bytesTransferred,   // optional
    void* reserved
);

パラメーター

名前方向
connectedBusHandleHANDLEin
buffervoid*inoptional
bytesToWriteDWORDin
bytesTransferredDWORD*outoptional
reservedvoid*inout

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL AllJoynSendToBus(
    HANDLE connectedBusHandle,
    const void* buffer,   // optional
    DWORD bytesToWrite,
    DWORD* bytesTransferred,   // optional
    void* reserved
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MSAJApi.dll", SetLastError = true, ExactSpelling = true)]
static extern bool AllJoynSendToBus(
    IntPtr connectedBusHandle,   // HANDLE
    IntPtr buffer,   // void* optional
    uint bytesToWrite,   // DWORD
    IntPtr bytesTransferred,   // DWORD* optional, out
    IntPtr reserved   // void* in/out
);
<DllImport("MSAJApi.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function AllJoynSendToBus(
    connectedBusHandle As IntPtr,   ' HANDLE
    buffer As IntPtr,   ' void* optional
    bytesToWrite As UInteger,   ' DWORD
    bytesTransferred As IntPtr,   ' DWORD* optional, out
    reserved As IntPtr   ' void* in/out
) As Boolean
End Function
' connectedBusHandle : HANDLE
' buffer : void* optional
' bytesToWrite : DWORD
' bytesTransferred : DWORD* optional, out
' reserved : void* in/out
Declare PtrSafe Function AllJoynSendToBus Lib "msajapi" ( _
    ByVal connectedBusHandle As LongPtr, _
    ByVal buffer As LongPtr, _
    ByVal bytesToWrite As Long, _
    ByVal bytesTransferred As LongPtr, _
    ByVal reserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

AllJoynSendToBus = ctypes.windll.msajapi.AllJoynSendToBus
AllJoynSendToBus.restype = wintypes.BOOL
AllJoynSendToBus.argtypes = [
    wintypes.HANDLE,  # connectedBusHandle : HANDLE
    ctypes.POINTER(None),  # buffer : void* optional
    wintypes.DWORD,  # bytesToWrite : DWORD
    ctypes.POINTER(wintypes.DWORD),  # bytesTransferred : DWORD* optional, out
    ctypes.POINTER(None),  # reserved : void* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSAJApi.dll')
AllJoynSendToBus = Fiddle::Function.new(
  lib['AllJoynSendToBus'],
  [
    Fiddle::TYPE_VOIDP,  # connectedBusHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # buffer : void* optional
    -Fiddle::TYPE_INT,  # bytesToWrite : DWORD
    Fiddle::TYPE_VOIDP,  # bytesTransferred : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # reserved : void* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "msajapi")]
extern "system" {
    fn AllJoynSendToBus(
        connectedBusHandle: *mut core::ffi::c_void,  // HANDLE
        buffer: *const (),  // void* optional
        bytesToWrite: u32,  // DWORD
        bytesTransferred: *mut u32,  // DWORD* optional, out
        reserved: *mut ()  // void* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MSAJApi.dll", SetLastError = true)]
public static extern bool AllJoynSendToBus(IntPtr connectedBusHandle, IntPtr buffer, uint bytesToWrite, IntPtr bytesTransferred, IntPtr reserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_AllJoynSendToBus' -Namespace Win32 -PassThru
# $api::AllJoynSendToBus(connectedBusHandle, buffer, bytesToWrite, bytesTransferred, reserved)
#uselib "MSAJApi.dll"
#func global AllJoynSendToBus "AllJoynSendToBus" sptr, sptr, sptr, sptr, sptr
; AllJoynSendToBus connectedBusHandle, buffer, bytesToWrite, varptr(bytesTransferred), reserved   ; 戻り値は stat
; connectedBusHandle : HANDLE -> "sptr"
; buffer : void* optional -> "sptr"
; bytesToWrite : DWORD -> "sptr"
; bytesTransferred : DWORD* optional, out -> "sptr"
; reserved : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MSAJApi.dll"
#cfunc global AllJoynSendToBus "AllJoynSendToBus" sptr, sptr, int, var, sptr
; res = AllJoynSendToBus(connectedBusHandle, buffer, bytesToWrite, bytesTransferred, reserved)
; connectedBusHandle : HANDLE -> "sptr"
; buffer : void* optional -> "sptr"
; bytesToWrite : DWORD -> "int"
; bytesTransferred : DWORD* optional, out -> "var"
; reserved : void* in/out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL AllJoynSendToBus(HANDLE connectedBusHandle, void* buffer, DWORD bytesToWrite, DWORD* bytesTransferred, void* reserved)
#uselib "MSAJApi.dll"
#cfunc global AllJoynSendToBus "AllJoynSendToBus" intptr, intptr, int, var, intptr
; res = AllJoynSendToBus(connectedBusHandle, buffer, bytesToWrite, bytesTransferred, reserved)
; connectedBusHandle : HANDLE -> "intptr"
; buffer : void* optional -> "intptr"
; bytesToWrite : DWORD -> "int"
; bytesTransferred : DWORD* optional, out -> "var"
; reserved : void* in/out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
	procAllJoynSendToBus = msajapi.NewProc("AllJoynSendToBus")
)

// connectedBusHandle (HANDLE), buffer (void* optional), bytesToWrite (DWORD), bytesTransferred (DWORD* optional, out), reserved (void* in/out)
r1, _, err := procAllJoynSendToBus.Call(
	uintptr(connectedBusHandle),
	uintptr(buffer),
	uintptr(bytesToWrite),
	uintptr(bytesTransferred),
	uintptr(reserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function AllJoynSendToBus(
  connectedBusHandle: THandle;   // HANDLE
  buffer: Pointer;   // void* optional
  bytesToWrite: DWORD;   // DWORD
  bytesTransferred: Pointer;   // DWORD* optional, out
  reserved: Pointer   // void* in/out
): BOOL; stdcall;
  external 'MSAJApi.dll' name 'AllJoynSendToBus';
result := DllCall("MSAJApi\AllJoynSendToBus"
    , "Ptr", connectedBusHandle   ; HANDLE
    , "Ptr", buffer   ; void* optional
    , "UInt", bytesToWrite   ; DWORD
    , "Ptr", bytesTransferred   ; DWORD* optional, out
    , "Ptr", reserved   ; void* in/out
    , "Int")   ; return: BOOL
●AllJoynSendToBus(connectedBusHandle, buffer, bytesToWrite, bytesTransferred, reserved) = DLL("MSAJApi.dll", "bool AllJoynSendToBus(void*, void*, dword, void*, void*)")
# 呼び出し: AllJoynSendToBus(connectedBusHandle, buffer, bytesToWrite, bytesTransferred, reserved)
# connectedBusHandle : HANDLE -> "void*"
# buffer : void* optional -> "void*"
# bytesToWrite : DWORD -> "dword"
# bytesTransferred : DWORD* optional, out -> "void*"
# reserved : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。