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