ホーム › Devices.Bluetooth › BluetoothAuthenticateMultipleDevices
BluetoothAuthenticateMultipleDevices
関数複数のBluetoothデバイスをまとめて認証する。
シグネチャ
// bthprops.cpl
#include <windows.h>
DWORD BluetoothAuthenticateMultipleDevices(
HWND hwndParent, // optional
HANDLE hRadio, // optional
DWORD cDevices,
BLUETOOTH_DEVICE_INFO* rgbtdi
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwndParent | HWND | inoptional |
| hRadio | HANDLE | inoptional |
| cDevices | DWORD | in |
| rgbtdi | BLUETOOTH_DEVICE_INFO* | inout |
戻り値の型: DWORD
各言語での呼び出し定義
// bthprops.cpl
#include <windows.h>
DWORD BluetoothAuthenticateMultipleDevices(
HWND hwndParent, // optional
HANDLE hRadio, // optional
DWORD cDevices,
BLUETOOTH_DEVICE_INFO* rgbtdi
);[DllImport("bthprops.cpl", ExactSpelling = true)]
static extern uint BluetoothAuthenticateMultipleDevices(
IntPtr hwndParent, // HWND optional
IntPtr hRadio, // HANDLE optional
uint cDevices, // DWORD
IntPtr rgbtdi // BLUETOOTH_DEVICE_INFO* in/out
);<DllImport("bthprops.cpl", ExactSpelling:=True)>
Public Shared Function BluetoothAuthenticateMultipleDevices(
hwndParent As IntPtr, ' HWND optional
hRadio As IntPtr, ' HANDLE optional
cDevices As UInteger, ' DWORD
rgbtdi As IntPtr ' BLUETOOTH_DEVICE_INFO* in/out
) As UInteger
End Function' hwndParent : HWND optional
' hRadio : HANDLE optional
' cDevices : DWORD
' rgbtdi : BLUETOOTH_DEVICE_INFO* in/out
Declare PtrSafe Function BluetoothAuthenticateMultipleDevices Lib "bthprops.cpl" ( _
ByVal hwndParent As LongPtr, _
ByVal hRadio As LongPtr, _
ByVal cDevices As Long, _
ByVal rgbtdi As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BluetoothAuthenticateMultipleDevices = ctypes.windll.LoadLibrary("bthprops.cpl").BluetoothAuthenticateMultipleDevices
BluetoothAuthenticateMultipleDevices.restype = wintypes.DWORD
BluetoothAuthenticateMultipleDevices.argtypes = [
wintypes.HANDLE, # hwndParent : HWND optional
wintypes.HANDLE, # hRadio : HANDLE optional
wintypes.DWORD, # cDevices : DWORD
ctypes.c_void_p, # rgbtdi : BLUETOOTH_DEVICE_INFO* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('bthprops.cpl')
BluetoothAuthenticateMultipleDevices = Fiddle::Function.new(
lib['BluetoothAuthenticateMultipleDevices'],
[
Fiddle::TYPE_VOIDP, # hwndParent : HWND optional
Fiddle::TYPE_VOIDP, # hRadio : HANDLE optional
-Fiddle::TYPE_INT, # cDevices : DWORD
Fiddle::TYPE_VOIDP, # rgbtdi : BLUETOOTH_DEVICE_INFO* in/out
],
-Fiddle::TYPE_INT)#[link(name = "bthprops.cpl")]
extern "system" {
fn BluetoothAuthenticateMultipleDevices(
hwndParent: *mut core::ffi::c_void, // HWND optional
hRadio: *mut core::ffi::c_void, // HANDLE optional
cDevices: u32, // DWORD
rgbtdi: *mut BLUETOOTH_DEVICE_INFO // BLUETOOTH_DEVICE_INFO* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("bthprops.cpl")]
public static extern uint BluetoothAuthenticateMultipleDevices(IntPtr hwndParent, IntPtr hRadio, uint cDevices, IntPtr rgbtdi);
"@
$api = Add-Type -MemberDefinition $sig -Name 'bthprops.cpl_BluetoothAuthenticateMultipleDevices' -Namespace Win32 -PassThru
# $api::BluetoothAuthenticateMultipleDevices(hwndParent, hRadio, cDevices, rgbtdi)#uselib "bthprops.cpl"
#func global BluetoothAuthenticateMultipleDevices "BluetoothAuthenticateMultipleDevices" sptr, sptr, sptr, sptr
; BluetoothAuthenticateMultipleDevices hwndParent, hRadio, cDevices, varptr(rgbtdi) ; 戻り値は stat
; hwndParent : HWND optional -> "sptr"
; hRadio : HANDLE optional -> "sptr"
; cDevices : DWORD -> "sptr"
; rgbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "bthprops.cpl" #cfunc global BluetoothAuthenticateMultipleDevices "BluetoothAuthenticateMultipleDevices" sptr, sptr, int, var ; res = BluetoothAuthenticateMultipleDevices(hwndParent, hRadio, cDevices, rgbtdi) ; hwndParent : HWND optional -> "sptr" ; hRadio : HANDLE optional -> "sptr" ; cDevices : DWORD -> "int" ; rgbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "bthprops.cpl" #cfunc global BluetoothAuthenticateMultipleDevices "BluetoothAuthenticateMultipleDevices" sptr, sptr, int, sptr ; res = BluetoothAuthenticateMultipleDevices(hwndParent, hRadio, cDevices, varptr(rgbtdi)) ; hwndParent : HWND optional -> "sptr" ; hRadio : HANDLE optional -> "sptr" ; cDevices : DWORD -> "int" ; rgbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD BluetoothAuthenticateMultipleDevices(HWND hwndParent, HANDLE hRadio, DWORD cDevices, BLUETOOTH_DEVICE_INFO* rgbtdi) #uselib "bthprops.cpl" #cfunc global BluetoothAuthenticateMultipleDevices "BluetoothAuthenticateMultipleDevices" intptr, intptr, int, var ; res = BluetoothAuthenticateMultipleDevices(hwndParent, hRadio, cDevices, rgbtdi) ; hwndParent : HWND optional -> "intptr" ; hRadio : HANDLE optional -> "intptr" ; cDevices : DWORD -> "int" ; rgbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD BluetoothAuthenticateMultipleDevices(HWND hwndParent, HANDLE hRadio, DWORD cDevices, BLUETOOTH_DEVICE_INFO* rgbtdi) #uselib "bthprops.cpl" #cfunc global BluetoothAuthenticateMultipleDevices "BluetoothAuthenticateMultipleDevices" intptr, intptr, int, intptr ; res = BluetoothAuthenticateMultipleDevices(hwndParent, hRadio, cDevices, varptr(rgbtdi)) ; hwndParent : HWND optional -> "intptr" ; hRadio : HANDLE optional -> "intptr" ; cDevices : DWORD -> "int" ; rgbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
bthprops_cpl = windows.NewLazySystemDLL("bthprops.cpl")
procBluetoothAuthenticateMultipleDevices = bthprops_cpl.NewProc("BluetoothAuthenticateMultipleDevices")
)
// hwndParent (HWND optional), hRadio (HANDLE optional), cDevices (DWORD), rgbtdi (BLUETOOTH_DEVICE_INFO* in/out)
r1, _, err := procBluetoothAuthenticateMultipleDevices.Call(
uintptr(hwndParent),
uintptr(hRadio),
uintptr(cDevices),
uintptr(rgbtdi),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction BluetoothAuthenticateMultipleDevices(
hwndParent: THandle; // HWND optional
hRadio: THandle; // HANDLE optional
cDevices: DWORD; // DWORD
rgbtdi: Pointer // BLUETOOTH_DEVICE_INFO* in/out
): DWORD; stdcall;
external 'bthprops.cpl' name 'BluetoothAuthenticateMultipleDevices';result := DllCall("bthprops.cpl\BluetoothAuthenticateMultipleDevices"
, "Ptr", hwndParent ; HWND optional
, "Ptr", hRadio ; HANDLE optional
, "UInt", cDevices ; DWORD
, "Ptr", rgbtdi ; BLUETOOTH_DEVICE_INFO* in/out
, "UInt") ; return: DWORD●BluetoothAuthenticateMultipleDevices(hwndParent, hRadio, cDevices, rgbtdi) = DLL("bthprops.cpl", "dword BluetoothAuthenticateMultipleDevices(void*, void*, dword, void*)")
# 呼び出し: BluetoothAuthenticateMultipleDevices(hwndParent, hRadio, cDevices, rgbtdi)
# hwndParent : HWND optional -> "void*"
# hRadio : HANDLE optional -> "void*"
# cDevices : DWORD -> "dword"
# rgbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。