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