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

BLUETOOTH_COD_PAIRS

構造体
サイズx64: 16 バイト / x86: 8 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ulCODMaskDWORD4+0+0デバイスクラスをフィルタするためのClass of Deviceマスク値。
pcszDescriptionLPWSTR8/4+8+4マスクに対応する説明文字列へのポインタ。UI表示用。

各言語での定義

#include <windows.h>

// BLUETOOTH_COD_PAIRS  (x64 16 / x86 8 バイト)
typedef struct BLUETOOTH_COD_PAIRS {
    DWORD ulCODMask;
    LPWSTR pcszDescription;
} BLUETOOTH_COD_PAIRS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BLUETOOTH_COD_PAIRS
{
    public uint ulCODMask;
    public IntPtr pcszDescription;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BLUETOOTH_COD_PAIRS
    Public ulCODMask As UInteger
    Public pcszDescription As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class BLUETOOTH_COD_PAIRS(ctypes.Structure):
    _fields_ = [
        ("ulCODMask", wintypes.DWORD),
        ("pcszDescription", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct BLUETOOTH_COD_PAIRS {
    pub ulCODMask: u32,
    pub pcszDescription: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type BLUETOOTH_COD_PAIRS struct {
	ulCODMask uint32
	pcszDescription uintptr
}
type
  BLUETOOTH_COD_PAIRS = record
    ulCODMask: DWORD;
    pcszDescription: Pointer;
  end;
const BLUETOOTH_COD_PAIRS = extern struct {
    ulCODMask: u32,
    pcszDescription: ?*anyopaque,
};
type
  BLUETOOTH_COD_PAIRS {.bycopy.} = object
    ulCODMask: uint32
    pcszDescription: pointer
struct BLUETOOTH_COD_PAIRS
{
    uint ulCODMask;
    void* pcszDescription;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; BLUETOOTH_COD_PAIRS サイズ: 8 バイト(x86)
dim st, 2    ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; ulCODMask : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pcszDescription : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BLUETOOTH_COD_PAIRS サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; ulCODMask : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pcszDescription : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global BLUETOOTH_COD_PAIRS
    #field int ulCODMask
    #field intptr pcszDescription
#endstruct

stdim st, BLUETOOTH_COD_PAIRS        ; NSTRUCT 変数を確保
st->ulCODMask = 100
mes "ulCODMask=" + st->ulCODMask