ホーム › Devices.Bluetooth › BluetoothUpdateDeviceRecord
BluetoothUpdateDeviceRecord
関数Bluetoothデバイスのキャッシュ情報を更新する。
シグネチャ
// BluetoothApis.dll
#include <windows.h>
DWORD BluetoothUpdateDeviceRecord(
const BLUETOOTH_DEVICE_INFO* pbtdi
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pbtdi | BLUETOOTH_DEVICE_INFO* | in | システムのキャッシュ済みデバイス記録を更新する情報を持つ構造体ポインタ。 |
戻り値の型: DWORD
各言語での呼び出し定義
// BluetoothApis.dll
#include <windows.h>
DWORD BluetoothUpdateDeviceRecord(
const BLUETOOTH_DEVICE_INFO* pbtdi
);[DllImport("BluetoothApis.dll", ExactSpelling = true)]
static extern uint BluetoothUpdateDeviceRecord(
IntPtr pbtdi // BLUETOOTH_DEVICE_INFO*
);<DllImport("BluetoothApis.dll", ExactSpelling:=True)>
Public Shared Function BluetoothUpdateDeviceRecord(
pbtdi As IntPtr ' BLUETOOTH_DEVICE_INFO*
) As UInteger
End Function' pbtdi : BLUETOOTH_DEVICE_INFO*
Declare PtrSafe Function BluetoothUpdateDeviceRecord Lib "bluetoothapis" ( _
ByVal pbtdi As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BluetoothUpdateDeviceRecord = ctypes.windll.bluetoothapis.BluetoothUpdateDeviceRecord
BluetoothUpdateDeviceRecord.restype = wintypes.DWORD
BluetoothUpdateDeviceRecord.argtypes = [
ctypes.c_void_p, # pbtdi : BLUETOOTH_DEVICE_INFO*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('BluetoothApis.dll')
BluetoothUpdateDeviceRecord = Fiddle::Function.new(
lib['BluetoothUpdateDeviceRecord'],
[
Fiddle::TYPE_VOIDP, # pbtdi : BLUETOOTH_DEVICE_INFO*
],
-Fiddle::TYPE_INT)#[link(name = "bluetoothapis")]
extern "system" {
fn BluetoothUpdateDeviceRecord(
pbtdi: *const BLUETOOTH_DEVICE_INFO // BLUETOOTH_DEVICE_INFO*
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("BluetoothApis.dll")]
public static extern uint BluetoothUpdateDeviceRecord(IntPtr pbtdi);
"@
$api = Add-Type -MemberDefinition $sig -Name 'BluetoothApis_BluetoothUpdateDeviceRecord' -Namespace Win32 -PassThru
# $api::BluetoothUpdateDeviceRecord(pbtdi)#uselib "BluetoothApis.dll"
#func global BluetoothUpdateDeviceRecord "BluetoothUpdateDeviceRecord" sptr
; BluetoothUpdateDeviceRecord varptr(pbtdi) ; 戻り値は stat
; pbtdi : BLUETOOTH_DEVICE_INFO* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "BluetoothApis.dll" #cfunc global BluetoothUpdateDeviceRecord "BluetoothUpdateDeviceRecord" var ; res = BluetoothUpdateDeviceRecord(pbtdi) ; pbtdi : BLUETOOTH_DEVICE_INFO* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "BluetoothApis.dll" #cfunc global BluetoothUpdateDeviceRecord "BluetoothUpdateDeviceRecord" sptr ; res = BluetoothUpdateDeviceRecord(varptr(pbtdi)) ; pbtdi : BLUETOOTH_DEVICE_INFO* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD BluetoothUpdateDeviceRecord(BLUETOOTH_DEVICE_INFO* pbtdi) #uselib "BluetoothApis.dll" #cfunc global BluetoothUpdateDeviceRecord "BluetoothUpdateDeviceRecord" var ; res = BluetoothUpdateDeviceRecord(pbtdi) ; pbtdi : BLUETOOTH_DEVICE_INFO* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD BluetoothUpdateDeviceRecord(BLUETOOTH_DEVICE_INFO* pbtdi) #uselib "BluetoothApis.dll" #cfunc global BluetoothUpdateDeviceRecord "BluetoothUpdateDeviceRecord" intptr ; res = BluetoothUpdateDeviceRecord(varptr(pbtdi)) ; pbtdi : BLUETOOTH_DEVICE_INFO* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
bluetoothapis = windows.NewLazySystemDLL("BluetoothApis.dll")
procBluetoothUpdateDeviceRecord = bluetoothapis.NewProc("BluetoothUpdateDeviceRecord")
)
// pbtdi (BLUETOOTH_DEVICE_INFO*)
r1, _, err := procBluetoothUpdateDeviceRecord.Call(
uintptr(pbtdi),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction BluetoothUpdateDeviceRecord(
pbtdi: Pointer // BLUETOOTH_DEVICE_INFO*
): DWORD; stdcall;
external 'BluetoothApis.dll' name 'BluetoothUpdateDeviceRecord';result := DllCall("BluetoothApis\BluetoothUpdateDeviceRecord"
, "Ptr", pbtdi ; BLUETOOTH_DEVICE_INFO*
, "UInt") ; return: DWORD●BluetoothUpdateDeviceRecord(pbtdi) = DLL("BluetoothApis.dll", "dword BluetoothUpdateDeviceRecord(void*)")
# 呼び出し: BluetoothUpdateDeviceRecord(pbtdi)
# pbtdi : BLUETOOTH_DEVICE_INFO* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "bluetoothapis" fn BluetoothUpdateDeviceRecord(
pbtdi: [*c]BLUETOOTH_DEVICE_INFO // BLUETOOTH_DEVICE_INFO*
) callconv(std.os.windows.WINAPI) u32;proc BluetoothUpdateDeviceRecord(
pbtdi: ptr BLUETOOTH_DEVICE_INFO # BLUETOOTH_DEVICE_INFO*
): uint32 {.importc: "BluetoothUpdateDeviceRecord", stdcall, dynlib: "BluetoothApis.dll".}pragma(lib, "bluetoothapis");
extern(Windows)
uint BluetoothUpdateDeviceRecord(
BLUETOOTH_DEVICE_INFO* pbtdi // BLUETOOTH_DEVICE_INFO*
);ccall((:BluetoothUpdateDeviceRecord, "BluetoothApis.dll"), stdcall, UInt32,
(Ptr{BLUETOOTH_DEVICE_INFO},),
pbtdi)
# pbtdi : BLUETOOTH_DEVICE_INFO* -> Ptr{BLUETOOTH_DEVICE_INFO}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t BluetoothUpdateDeviceRecord(
void* pbtdi);
]]
local bluetoothapis = ffi.load("bluetoothapis")
-- bluetoothapis.BluetoothUpdateDeviceRecord(pbtdi)
-- pbtdi : BLUETOOTH_DEVICE_INFO*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('BluetoothApis.dll');
const BluetoothUpdateDeviceRecord = lib.func('__stdcall', 'BluetoothUpdateDeviceRecord', 'uint32_t', ['void *']);
// BluetoothUpdateDeviceRecord(pbtdi)
// pbtdi : BLUETOOTH_DEVICE_INFO* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("BluetoothApis.dll", {
BluetoothUpdateDeviceRecord: { parameters: ["pointer"], result: "u32" },
});
// lib.symbols.BluetoothUpdateDeviceRecord(pbtdi)
// pbtdi : BLUETOOTH_DEVICE_INFO* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t BluetoothUpdateDeviceRecord(
void* pbtdi);
C, "BluetoothApis.dll");
// $ffi->BluetoothUpdateDeviceRecord(pbtdi);
// pbtdi : BLUETOOTH_DEVICE_INFO*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Bluetoothapis extends StdCallLibrary {
Bluetoothapis INSTANCE = Native.load("bluetoothapis", Bluetoothapis.class);
int BluetoothUpdateDeviceRecord(
Pointer pbtdi // BLUETOOTH_DEVICE_INFO*
);
}@[Link("bluetoothapis")]
lib LibBluetoothApis
fun BluetoothUpdateDeviceRecord = BluetoothUpdateDeviceRecord(
pbtdi : BLUETOOTH_DEVICE_INFO* # BLUETOOTH_DEVICE_INFO*
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef BluetoothUpdateDeviceRecordNative = Uint32 Function(Pointer<Void>);
typedef BluetoothUpdateDeviceRecordDart = int Function(Pointer<Void>);
final BluetoothUpdateDeviceRecord = DynamicLibrary.open('BluetoothApis.dll')
.lookupFunction<BluetoothUpdateDeviceRecordNative, BluetoothUpdateDeviceRecordDart>('BluetoothUpdateDeviceRecord');
// pbtdi : BLUETOOTH_DEVICE_INFO* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function BluetoothUpdateDeviceRecord(
pbtdi: Pointer // BLUETOOTH_DEVICE_INFO*
): DWORD; stdcall;
external 'BluetoothApis.dll' name 'BluetoothUpdateDeviceRecord';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "BluetoothUpdateDeviceRecord"
c_BluetoothUpdateDeviceRecord :: Ptr () -> IO Word32
-- pbtdi : BLUETOOTH_DEVICE_INFO* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let bluetoothupdatedevicerecord =
foreign "BluetoothUpdateDeviceRecord"
((ptr void) @-> returning uint32_t)
(* pbtdi : BLUETOOTH_DEVICE_INFO* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library bluetoothapis (t "BluetoothApis.dll"))
(cffi:use-foreign-library bluetoothapis)
(cffi:defcfun ("BluetoothUpdateDeviceRecord" bluetooth-update-device-record :convention :stdcall) :uint32
(pbtdi :pointer)) ; BLUETOOTH_DEVICE_INFO*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $BluetoothUpdateDeviceRecord = Win32::API::More->new('BluetoothApis',
'DWORD BluetoothUpdateDeviceRecord(LPVOID pbtdi)');
# my $ret = $BluetoothUpdateDeviceRecord->Call($pbtdi);
# pbtdi : BLUETOOTH_DEVICE_INFO* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。