• 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

    2 Mal editiert, zuletzt von masterplc (29. August 2013 um 00:07) aus folgendem Grund: Textformatierungsfail.

  • 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.

    There's a joke that C has the speed and efficieny of assembly language combined with readability of....assembly language. In other words, it's just a glorified assembly language. - Teh Interwebz

    C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, you blow off your whole leg. - Bjarne Stroustrup
    Genie zu sein, bedeutet für mich, alles zu tun, was ich will. - Klaus Kinski

  • Wo liegt denn bitte dein Problem?

    Spoiler anzeigen
    [autoit]

    #include <WinAPI.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Local $phRadio
    $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

    [/autoit] [autoit][/autoit] [autoit]

    _BluetoothFindFirstDevice()
    Sleep(10000)
    _BluetoothRegisterForAuthenticationEx()

    [/autoit] [autoit][/autoit] [autoit]

    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 ;==>_BluetoothFindFirstDevice

    [/autoit] [autoit][/autoit] [autoit]

    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 ;==>_BluetoothFindFirstRadio

    [/autoit] [autoit][/autoit] [autoit]

    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 ;==>_BluetoothFindRadioClose

    [/autoit] [autoit][/autoit] [autoit]

    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 ;==>_BluetoothFindNextDevice

    [/autoit] [autoit][/autoit] [autoit]

    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 ;==>_BluetoothRegisterForAuthenticationEx

    [/autoit]

    LG
    Christoph :)