How can I disable Bluetooth connectability?

Jin Cheng 0 Reputation points
2026-08-13T03:33:46.9966667+00:00

I have a console application that enumerates all Bluetooth radios on the system and finds only one. I then call BluetoothEnableDiscovery(NULL, FALSE) followed by BluetoothEnableIncomingConnections(NULL, FALSE) for that radio. However, BluetoothIsConnectable(NULL) still returns TRUE. test program:

#include <windows.h>
#include <bluetoothapis.h>
#include <stdio.h>
#pragma comment(lib, "Bthprops.lib")
int main()
{
    BLUETOOTH_FIND_RADIO_PARAMS params = {};
    params.dwSize = sizeof(params);
    HBLUETOOTH_RADIO_FIND hFind = NULL;
    HANDLE hRadio = NULL;
    hFind = BluetoothFindFirstRadio(&params, &hRadio);
    if (hFind == NULL)
    {
        printf("BluetoothFindFirstRadio failed: 0x%08X\n",
            GetLastError());
        return 1;
    }
    int radioCount = 1;
    // Check for additional Bluetooth radios.
    HANDLE hNextRadio = NULL;
    while (BluetoothFindNextRadio(hFind, &hNextRadio))
    {
        radioCount++;
        CloseHandle(hNextRadio);
        hNextRadio = NULL;
    }
    printf("Bluetooth radio count: %d\n", radioCount);
    if (radioCount != 1)
    {
        printf("Expected exactly one Bluetooth radio.\n");
        CloseHandle(hRadio);
        BluetoothFindRadioClose(hFind);
        return 1;
    }
    printf("\nInitial state:\n");
    BOOL discoverable = BluetoothIsDiscoverable(NULL);
    BOOL connectable = BluetoothIsConnectable(NULL);
    printf("  Discoverable: %s\n",
        discoverable ? "TRUE" : "FALSE");
    printf("  Connectable : %s\n",
        connectable ? "TRUE" : "FALSE");
    printf("\nDisable discovery:\n");
    SetLastError(ERROR_SUCCESS);
    BOOL ret = BluetoothEnableDiscovery(NULL, FALSE);
    printf("  BluetoothEnableDiscovery(NULL, FALSE): %s\n",
        ret ? "TRUE" : "FALSE");
    if (!ret)
        printf("  GetLastError: 0x%08X\n", GetLastError());
    printf("\nDisable incoming connections:\n");
    SetLastError(ERROR_SUCCESS);
    ret = BluetoothEnableIncomingConnections(NULL, FALSE);
    printf("  BluetoothEnableIncomingConnections(NULL, FALSE): %s\n",
        ret ? "TRUE" : "FALSE");
    if (!ret)
        printf("  GetLastError: 0x%08X\n", GetLastError());
    printf("\nFinal state:\n");
    discoverable = BluetoothIsDiscoverable(NULL);
    connectable = BluetoothIsConnectable(NULL);
    printf("  Discoverable: %s\n",
        discoverable ? "TRUE" : "FALSE");
    printf("  Connectable : %s\n",
        connectable ? "TRUE" : "FALSE");
    CloseHandle(hRadio);
    BluetoothFindRadioClose(hFind);
    printf("\nPress Enter to exit...");
    getchar();
    return 0;
}

console output:


Bluetooth radio count: 1

Initial state:

  Discoverable: FALSE

  Connectable : TRUE

Disable discovery:

  BluetoothEnableDiscovery(NULL, FALSE): FALSE

  GetLastError: 0x80070057

Disable incoming connections:

  BluetoothEnableIncomingConnections(NULL, FALSE): FALSE

  GetLastError: 0x80070057

Final state:

  Discoverable: FALSE

  Connectable : TRUE

Press Enter to exit...

Windows development | Windows API - Win32
0 comments No comments

1 answer

Sort by: Most helpful
  1. Taki Ly (WICLOUD CORPORATION) 5,630 Reputation points Microsoft External Staff Moderator
    2026-08-13T07:07:46.3266667+00:00

    Hello @Jin Cheng ,

    Thanks for the detailed test program and console output.

    Looking at your run, both calls returned FALSE, which per the documentation means the state was not changed. For BluetoothEnableIncomingConnections, a FALSE return with hRadio = NULL indicates that no radio accepted the state change. BluetoothIsConnectable(NULL) returning TRUE is consistent with that, per BluetoothIsConnectable, it returns TRUE if at least one Bluetooth radio is accepting incoming connections. In other words, the radio does not appear to have moved to a non-connectable state at all.

    A few observations:

    The ordering precondition already looks satisfied. The documentation requires a radio to be non-discoverable before it can be made non-connectable. Your initial state already reports Discoverable = FALSE, so there is also no discovery state left to change, which may explain the FALSE return from BluetoothEnableDiscovery and suggests the failure is not caused by call ordering.

    On GetLastError. The documentation for these functions does not describe GetLastError behavior, so I would suggest not relying on 0x80070057 as the root cause indicator here.

    On hRadio = NULL. It may be worth passing the actual handle from BluetoothFindFirstRadio instead of NULL to rule out the "iterate all radios" path and sharing whether the return value differs.

    At this point I am not able to confirm whether a programmatic non-connectable state is achievable through BluetoothEnableIncomingConnections on your setup, since the call is returning FALSE consistently. Could you also share the exact Windows build (winver), the Bluetooth adapter model and driver version, and whether the machine is using the in-box Microsoft Bluetooth stack or a vendor stack? That would help clarify whether this is expected behavior or something specific to your adapter and environment.

    Possible alternative

    If the goal is simply to stop incoming connections, controlling the radio state directly may be a more reliable path than BluetoothEnableIncomingConnections:

    Windows.Devices.Radios.Radio with Radio.SetStateAsync set to RadioState.Off

    Disabling the adapter (Disable-PnpDevice) or airplane mode, if a full off state is acceptable for your scenario

    Please note that both of these turn the radio off entirely rather than keeping it powered but non-connectable. If your scenario requires the radio to stay on while refusing incoming connections, please let me know, that constraint would change the direction of the investigation.

    Looking forward to your update. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.

    Thank you.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.