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

BluetoothDisplayDeviceProperties

関数
Bluetoothデバイスのプロパティダイアログを表示する。
DLLbthprops.cpl呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

// bthprops.cpl
#include <windows.h>

BOOL BluetoothDisplayDeviceProperties(
    HWND hwndParent,   // optional
    BLUETOOTH_DEVICE_INFO* pbtdi
);

パラメーター

名前方向
hwndParentHWNDinoptional
pbtdiBLUETOOTH_DEVICE_INFO*inout

戻り値の型: BOOL

各言語での呼び出し定義

// bthprops.cpl
#include <windows.h>

BOOL BluetoothDisplayDeviceProperties(
    HWND hwndParent,   // optional
    BLUETOOTH_DEVICE_INFO* pbtdi
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("bthprops.cpl", SetLastError = true, ExactSpelling = true)]
static extern bool BluetoothDisplayDeviceProperties(
    IntPtr hwndParent,   // HWND optional
    IntPtr pbtdi   // BLUETOOTH_DEVICE_INFO* in/out
);
<DllImport("bthprops.cpl", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function BluetoothDisplayDeviceProperties(
    hwndParent As IntPtr,   ' HWND optional
    pbtdi As IntPtr   ' BLUETOOTH_DEVICE_INFO* in/out
) As Boolean
End Function
' hwndParent : HWND optional
' pbtdi : BLUETOOTH_DEVICE_INFO* in/out
Declare PtrSafe Function BluetoothDisplayDeviceProperties Lib "bthprops.cpl" ( _
    ByVal hwndParent 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

BluetoothDisplayDeviceProperties = ctypes.windll.LoadLibrary("bthprops.cpl").BluetoothDisplayDeviceProperties
BluetoothDisplayDeviceProperties.restype = wintypes.BOOL
BluetoothDisplayDeviceProperties.argtypes = [
    wintypes.HANDLE,  # hwndParent : HWND optional
    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('bthprops.cpl')
BluetoothDisplayDeviceProperties = Fiddle::Function.new(
  lib['BluetoothDisplayDeviceProperties'],
  [
    Fiddle::TYPE_VOIDP,  # hwndParent : HWND optional
    Fiddle::TYPE_VOIDP,  # pbtdi : BLUETOOTH_DEVICE_INFO* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "bthprops.cpl")]
extern "system" {
    fn BluetoothDisplayDeviceProperties(
        hwndParent: *mut core::ffi::c_void,  // HWND optional
        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("bthprops.cpl", SetLastError = true)]
public static extern bool BluetoothDisplayDeviceProperties(IntPtr hwndParent, IntPtr pbtdi);
"@
$api = Add-Type -MemberDefinition $sig -Name 'bthprops.cpl_BluetoothDisplayDeviceProperties' -Namespace Win32 -PassThru
# $api::BluetoothDisplayDeviceProperties(hwndParent, pbtdi)
#uselib "bthprops.cpl"
#func global BluetoothDisplayDeviceProperties "BluetoothDisplayDeviceProperties" sptr, sptr
; BluetoothDisplayDeviceProperties hwndParent, varptr(pbtdi)   ; 戻り値は stat
; hwndParent : HWND optional -> "sptr"
; pbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "bthprops.cpl"
#cfunc global BluetoothDisplayDeviceProperties "BluetoothDisplayDeviceProperties" sptr, var
; res = BluetoothDisplayDeviceProperties(hwndParent, pbtdi)
; hwndParent : HWND optional -> "sptr"
; pbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL BluetoothDisplayDeviceProperties(HWND hwndParent, BLUETOOTH_DEVICE_INFO* pbtdi)
#uselib "bthprops.cpl"
#cfunc global BluetoothDisplayDeviceProperties "BluetoothDisplayDeviceProperties" intptr, var
; res = BluetoothDisplayDeviceProperties(hwndParent, pbtdi)
; hwndParent : HWND optional -> "intptr"
; pbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	bthprops_cpl = windows.NewLazySystemDLL("bthprops.cpl")
	procBluetoothDisplayDeviceProperties = bthprops_cpl.NewProc("BluetoothDisplayDeviceProperties")
)

// hwndParent (HWND optional), pbtdi (BLUETOOTH_DEVICE_INFO* in/out)
r1, _, err := procBluetoothDisplayDeviceProperties.Call(
	uintptr(hwndParent),
	uintptr(pbtdi),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function BluetoothDisplayDeviceProperties(
  hwndParent: THandle;   // HWND optional
  pbtdi: Pointer   // BLUETOOTH_DEVICE_INFO* in/out
): BOOL; stdcall;
  external 'bthprops.cpl' name 'BluetoothDisplayDeviceProperties';
result := DllCall("bthprops.cpl\BluetoothDisplayDeviceProperties"
    , "Ptr", hwndParent   ; HWND optional
    , "Ptr", pbtdi   ; BLUETOOTH_DEVICE_INFO* in/out
    , "Int")   ; return: BOOL
●BluetoothDisplayDeviceProperties(hwndParent, pbtdi) = DLL("bthprops.cpl", "bool BluetoothDisplayDeviceProperties(void*, void*)")
# 呼び出し: BluetoothDisplayDeviceProperties(hwndParent, pbtdi)
# hwndParent : HWND optional -> "void*"
# pbtdi : BLUETOOTH_DEVICE_INFO* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。