ホーム › Devices.Bluetooth › BLUETOOTH_SELECT_DEVICE_PARAMS
BLUETOOTH_SELECT_DEVICE_PARAMS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | この構造体のバイト単位サイズ。呼び出し前に設定する必要がある。 |
| cNumOfClasses | DWORD | 4 | +4 | +4 | prgClassOfDevices配列の要素数を示す。0で全クラスを表示。 |
| prgClassOfDevices | BLUETOOTH_COD_PAIRS* | 8/4 | +8 | +8 | 表示対象を絞り込むCODペア配列へのポインタ。NULL可。 |
| pszInfo | LPWSTR | 8/4 | +16 | +12 | ダイアログに表示する追加情報文字列へのポインタ。NULL可。 |
| hwndParent | HWND | 8/4 | +24 | +16 | 選択ダイアログの親ウィンドウハンドル。NULL可。 |
| fForceAuthentication | BOOL | 4 | +32 | +20 | 選択時に認証を強制するかを示すBOOL値。 |
| fShowAuthenticated | BOOL | 4 | +36 | +24 | 認証済みデバイスを表示するかを示すBOOL値。 |
| fShowRemembered | BOOL | 4 | +40 | +28 | 記憶済みデバイスを表示するかを示すBOOL値。 |
| fShowUnknown | BOOL | 4 | +44 | +32 | 未知デバイスを表示するかを示すBOOL値。 |
| fAddNewDeviceWizard | BOOL | 4 | +48 | +36 | 新規デバイス追加ウィザードとして表示するかを示すBOOL値。 |
| fSkipServicesPage | BOOL | 4 | +52 | +40 | サービス選択ページを省略するかを示すBOOL値。 |
| pfnDeviceCallback | PFN_DEVICE_CALLBACK | 8/4 | +56 | +44 | デバイス列挙時に呼ばれるコールバック関数へのポインタ。NULL可。 |
| pvParam | void* | 8/4 | +64 | +48 | コールバックに渡されるユーザー定義パラメータへのポインタ。 |
| cNumDevices | DWORD | 4 | +72 | +52 | 選択されたデバイス数(出力)。pDevices配列の有効要素数。 |
| pDevices | BLUETOOTH_DEVICE_INFO* | 8/4 | +80 | +56 | 選択結果のデバイス情報配列へのポインタ(出力)。 |
各言語での定義
#include <windows.h>
// BLUETOOTH_SELECT_DEVICE_PARAMS (x64 88 / x86 60 バイト)
typedef struct BLUETOOTH_SELECT_DEVICE_PARAMS {
DWORD dwSize;
DWORD cNumOfClasses;
BLUETOOTH_COD_PAIRS* prgClassOfDevices;
LPWSTR pszInfo;
HWND hwndParent;
BOOL fForceAuthentication;
BOOL fShowAuthenticated;
BOOL fShowRemembered;
BOOL fShowUnknown;
BOOL fAddNewDeviceWizard;
BOOL fSkipServicesPage;
PFN_DEVICE_CALLBACK pfnDeviceCallback;
void* pvParam;
DWORD cNumDevices;
BLUETOOTH_DEVICE_INFO* pDevices;
} BLUETOOTH_SELECT_DEVICE_PARAMS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BLUETOOTH_SELECT_DEVICE_PARAMS
{
public uint dwSize;
public uint cNumOfClasses;
public IntPtr prgClassOfDevices;
public IntPtr pszInfo;
public IntPtr hwndParent;
[MarshalAs(UnmanagedType.Bool)] public bool fForceAuthentication;
[MarshalAs(UnmanagedType.Bool)] public bool fShowAuthenticated;
[MarshalAs(UnmanagedType.Bool)] public bool fShowRemembered;
[MarshalAs(UnmanagedType.Bool)] public bool fShowUnknown;
[MarshalAs(UnmanagedType.Bool)] public bool fAddNewDeviceWizard;
[MarshalAs(UnmanagedType.Bool)] public bool fSkipServicesPage;
public IntPtr pfnDeviceCallback;
public IntPtr pvParam;
public uint cNumDevices;
public IntPtr pDevices;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BLUETOOTH_SELECT_DEVICE_PARAMS
Public dwSize As UInteger
Public cNumOfClasses As UInteger
Public prgClassOfDevices As IntPtr
Public pszInfo As IntPtr
Public hwndParent As IntPtr
<MarshalAs(UnmanagedType.Bool)> Public fForceAuthentication As Boolean
<MarshalAs(UnmanagedType.Bool)> Public fShowAuthenticated As Boolean
<MarshalAs(UnmanagedType.Bool)> Public fShowRemembered As Boolean
<MarshalAs(UnmanagedType.Bool)> Public fShowUnknown As Boolean
<MarshalAs(UnmanagedType.Bool)> Public fAddNewDeviceWizard As Boolean
<MarshalAs(UnmanagedType.Bool)> Public fSkipServicesPage As Boolean
Public pfnDeviceCallback As IntPtr
Public pvParam As IntPtr
Public cNumDevices As UInteger
Public pDevices As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class BLUETOOTH_SELECT_DEVICE_PARAMS(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("cNumOfClasses", wintypes.DWORD),
("prgClassOfDevices", ctypes.c_void_p),
("pszInfo", ctypes.c_void_p),
("hwndParent", ctypes.c_void_p),
("fForceAuthentication", wintypes.BOOL),
("fShowAuthenticated", wintypes.BOOL),
("fShowRemembered", wintypes.BOOL),
("fShowUnknown", wintypes.BOOL),
("fAddNewDeviceWizard", wintypes.BOOL),
("fSkipServicesPage", wintypes.BOOL),
("pfnDeviceCallback", ctypes.c_void_p),
("pvParam", ctypes.c_void_p),
("cNumDevices", wintypes.DWORD),
("pDevices", ctypes.c_void_p),
]#[repr(C)]
pub struct BLUETOOTH_SELECT_DEVICE_PARAMS {
pub dwSize: u32,
pub cNumOfClasses: u32,
pub prgClassOfDevices: *mut core::ffi::c_void,
pub pszInfo: *mut core::ffi::c_void,
pub hwndParent: *mut core::ffi::c_void,
pub fForceAuthentication: i32,
pub fShowAuthenticated: i32,
pub fShowRemembered: i32,
pub fShowUnknown: i32,
pub fAddNewDeviceWizard: i32,
pub fSkipServicesPage: i32,
pub pfnDeviceCallback: *mut core::ffi::c_void,
pub pvParam: *mut core::ffi::c_void,
pub cNumDevices: u32,
pub pDevices: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type BLUETOOTH_SELECT_DEVICE_PARAMS struct {
dwSize uint32
cNumOfClasses uint32
prgClassOfDevices uintptr
pszInfo uintptr
hwndParent uintptr
fForceAuthentication int32
fShowAuthenticated int32
fShowRemembered int32
fShowUnknown int32
fAddNewDeviceWizard int32
fSkipServicesPage int32
pfnDeviceCallback uintptr
pvParam uintptr
cNumDevices uint32
pDevices uintptr
}type
BLUETOOTH_SELECT_DEVICE_PARAMS = record
dwSize: DWORD;
cNumOfClasses: DWORD;
prgClassOfDevices: Pointer;
pszInfo: Pointer;
hwndParent: Pointer;
fForceAuthentication: BOOL;
fShowAuthenticated: BOOL;
fShowRemembered: BOOL;
fShowUnknown: BOOL;
fAddNewDeviceWizard: BOOL;
fSkipServicesPage: BOOL;
pfnDeviceCallback: Pointer;
pvParam: Pointer;
cNumDevices: DWORD;
pDevices: Pointer;
end;const BLUETOOTH_SELECT_DEVICE_PARAMS = extern struct {
dwSize: u32,
cNumOfClasses: u32,
prgClassOfDevices: ?*anyopaque,
pszInfo: ?*anyopaque,
hwndParent: ?*anyopaque,
fForceAuthentication: i32,
fShowAuthenticated: i32,
fShowRemembered: i32,
fShowUnknown: i32,
fAddNewDeviceWizard: i32,
fSkipServicesPage: i32,
pfnDeviceCallback: ?*anyopaque,
pvParam: ?*anyopaque,
cNumDevices: u32,
pDevices: ?*anyopaque,
};type
BLUETOOTH_SELECT_DEVICE_PARAMS {.bycopy.} = object
dwSize: uint32
cNumOfClasses: uint32
prgClassOfDevices: pointer
pszInfo: pointer
hwndParent: pointer
fForceAuthentication: int32
fShowAuthenticated: int32
fShowRemembered: int32
fShowUnknown: int32
fAddNewDeviceWizard: int32
fSkipServicesPage: int32
pfnDeviceCallback: pointer
pvParam: pointer
cNumDevices: uint32
pDevices: pointerstruct BLUETOOTH_SELECT_DEVICE_PARAMS
{
uint dwSize;
uint cNumOfClasses;
void* prgClassOfDevices;
void* pszInfo;
void* hwndParent;
int fForceAuthentication;
int fShowAuthenticated;
int fShowRemembered;
int fShowUnknown;
int fAddNewDeviceWizard;
int fSkipServicesPage;
void* pfnDeviceCallback;
void* pvParam;
uint cNumDevices;
void* pDevices;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; BLUETOOTH_SELECT_DEVICE_PARAMS サイズ: 60 バイト(x86)
dim st, 15 ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cNumOfClasses : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; prgClassOfDevices : BLUETOOTH_COD_PAIRS* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; pszInfo : LPWSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; hwndParent : HWND (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; fForceAuthentication : BOOL (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; fShowAuthenticated : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; fShowRemembered : BOOL (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; fShowUnknown : BOOL (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; fAddNewDeviceWizard : BOOL (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; fSkipServicesPage : BOOL (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; pfnDeviceCallback : PFN_DEVICE_CALLBACK (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; pvParam : void* (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; cNumDevices : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; pDevices : BLUETOOTH_DEVICE_INFO* (+56, 4byte) varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BLUETOOTH_SELECT_DEVICE_PARAMS サイズ: 88 バイト(x64)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cNumOfClasses : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; prgClassOfDevices : BLUETOOTH_COD_PAIRS* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; pszInfo : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hwndParent : HWND (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; fForceAuthentication : BOOL (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; fShowAuthenticated : BOOL (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; fShowRemembered : BOOL (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; fShowUnknown : BOOL (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; fAddNewDeviceWizard : BOOL (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; fSkipServicesPage : BOOL (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; pfnDeviceCallback : PFN_DEVICE_CALLBACK (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; pvParam : void* (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; cNumDevices : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; pDevices : BLUETOOTH_DEVICE_INFO* (+80, 8byte) varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global BLUETOOTH_SELECT_DEVICE_PARAMS
#field int dwSize
#field int cNumOfClasses
#field intptr prgClassOfDevices
#field intptr pszInfo
#field intptr hwndParent
#field bool fForceAuthentication
#field bool fShowAuthenticated
#field bool fShowRemembered
#field bool fShowUnknown
#field bool fAddNewDeviceWizard
#field bool fSkipServicesPage
#field intptr pfnDeviceCallback
#field intptr pvParam
#field int cNumDevices
#field intptr pDevices
#endstruct
stdim st, BLUETOOTH_SELECT_DEVICE_PARAMS ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize