#include <WinAPI.au3>
Func _BluetoothFindFirstDevice($REMEMBER = False)
Local $HRESULT[3], $tBLUETOOTH_DEVICE_INFO
$tBLUETOOTH_DEVICE_SEARCH_PARAMS = DllStructCreate('DWORD;BOOL;BOOL;BOOL;BOOL;BOOL;BYTE;HANDLE')
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 1 , DllStructGetSize($tBLUETOOTH_DEVICE_SEARCH_PARAMS))
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 2 , False)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 3 , $REMEMBER)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 4 , True)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 5 , True)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 6 , True)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 7 , 6)
DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 8 , 0)
$tBLUETOOTH_DEVICE_INFO = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]')
DllStructSetData($tBLUETOOTH_DEVICE_INFO,1,DllStructGetSize($tBLUETOOTH_DEVICE_INFO))
$RESULT = DllCall("bthprops.cpl", "handle", "BluetoothFindFirstDevice", "struct*", $tBLUETOOTH_DEVICE_SEARCH_PARAMS, "struct*", $tBLUETOOTH_DEVICE_INFO)
$HRESULT[0] = DllStructGetData($tBLUETOOTH_DEVICE_INFO, 9)
$HRESULT[1] = DllStructGetData($tBLUETOOTH_DEVICE_INFO, 2)
$HRESULT[2] = DllStructGetData($tBLUETOOTH_DEVICE_INFO, 3)
Do
$ULTRA = _BluetoothFindNextDevice($RESULT[0])
until $ULTRA = "0"
Return $HRESULT
EndFunc
Func _BluetoothFindFirstRadio(ByRef $phRadio)
$tBLUETOOTH_FIND_RADIO_PARAMS = DllStructCreate('DWORD')
DllStructSetData($tBLUETOOTH_FIND_RADIO_PARAMS, 1 , DllStructGetSize($tBLUETOOTH_FIND_RADIO_PARAMS))
$aResult = DllCall("bthprops.cpl", "handle", "BluetoothFindFirstRadio", "struct*", $tBLUETOOTH_FIND_RADIO_PARAMS, "handle*", 0)
If @error Then Return SetError(2, @error, 0)
$phRadio = $aResult[2]
Return SetError($aResult[0] = 0, 0, $aResult[0])
EndFunc
Func _BluetoothFindRadioClose($hBtFind)
Local $aResult = DllCall("bthprops.cpl", "bool", "BluetoothFindRadioClose", "handle", $hBtFind)
If @error Then Return SetError(2, @error, 0)
Return SetError($aResult[0] = 0, 0, $aResult[0])
EndFunc
Func _BluetoothFindNextDevice($HANDLE)
$t1BLUETOOTH_DEVICE_INFO = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]')
$RESULTX = DllCall("bthprops.cpl", "Bool", "BluetoothFindNextDevice", "handle", $HANDLE, "struct*", $t1BLUETOOTH_DEVICE_INFO)
Return $RESULTX[0]
EndFunc
Func _BluetoothRegisterForAuthenticationEx()
Local $ZRESULT, $tBLUETOOTH_DEVICE_REG
$tBLUETOOTH_DEVICE_REG = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]')
DllStructSetData($tBLUETOOTH_DEVICE_REG,1,DllStructGetSize($tBLUETOOTH_DEVICE_REG))
DllStructSetData($tBLUETOOTH_DEVICE_REG, 2 , 560)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 3 , 550377916751)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 4 , 9600)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 5 , False)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 6 , False)
DllStructSetData($tBLUETOOTH_DEVICE_REG, 7 , False)
$ZRESULT = DllCall("bthprops.cpl", "handle", "BluetoothRegisterForAuthenticationEx", "struct*", $tBLUETOOTH_DEVICE_REG, "handle*", 0)
Return $ZRESULT
EndFunc