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