Ich habe schon viele Threads gesehen in den es um Fragen zu Bluetooth ging.Hier habe ich einen kleinen Quellcode.Die Grundlagen habe ich zwar im Inet gefunden ich habe den Quellcode jedoch stark umfrisiert da mir das zu langsam und unverständlich war. Ich hoffe die UDF hilft euch ein wenig.Vielleicht hat einer von euch ja Lust das weiterzuentwickeln :http://pastebin.com/yL8fZEen
Bluetooth UDF!!!
-
-
Post die UDF doch einfach auf Pastebin
Außerdem achte beim Einfügen, das du beim Editor im "Quellcode"-Tab bist. Dann sollte die Formatierung passen.
-
Nicht zu vergessen! Ist das Script lang genug um sich die Finger wund zu scrollen pack es in einen Spoiler bzw. nutz Pastebin.
-
Ne das mit der Formatierung war richtig komisch...
Ich war im Quellcode tab aber das gesamte Script wurde in eine Zeile gepackt. Ich werde das teil auf Paste packen. -
Wo liegt denn bitte dein Problem?
Spoiler anzeigen
[autoit]#include <WinAPI.au3>
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Local $phRadio
[/autoit] [autoit][/autoit] [autoit]
$hFind = _BluetoothFindFirstRadio($phRadio)
If $hFind = 0 Then
MsgBox(16, "Hardware error", "Unable to find compatible bluetooth radio(s) on this machine.")
_WinAPI_CloseHandle($phRadio)
_BluetoothFindRadioClose($hFind)
Exit
Else
_WinAPI_CloseHandle($phRadio)
_BluetoothFindRadioClose($hFind)
EndIf_BluetoothFindFirstDevice()
[/autoit] [autoit][/autoit] [autoit]
Sleep(10000)
_BluetoothRegisterForAuthenticationEx()Func _BluetoothFindFirstDevice($REMEMBER = False)
[/autoit] [autoit][/autoit] [autoit]
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 ;==>_BluetoothFindFirstDeviceFunc _BluetoothFindFirstRadio(ByRef $phRadio)
[/autoit] [autoit][/autoit] [autoit]
$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 ;==>_BluetoothFindFirstRadioFunc _BluetoothFindRadioClose($hBtFind)
[/autoit] [autoit][/autoit] [autoit]
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 ;==>_BluetoothFindRadioCloseFunc _BluetoothFindNextDevice($HANDLE)
[/autoit] [autoit][/autoit] [autoit]
$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 ;==>_BluetoothFindNextDeviceFunc _BluetoothRegisterForAuthenticationEx()
[/autoit]
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 ;==>_BluetoothRegisterForAuthenticationEx