#include <windows.h>
#include <BluetoothAPIs.h>
#include <conio.h>
#include <iostream>
#include <string>
#include <locale>
#pragma comment(lib,"Bthprops.lib")
using namespace std;
int main(void)
{
BLUETOOTH_SELECT_DEVICE_PARAMS pbtsdp = {sizeof(BLUETOOTH_SELECT_DEVICE_PARAMS) };
pbtsdp.fShowAuthenticated = TRUE;
pbtsdp.fShowRemembered = TRUE;
pbtsdp.fShowUnknown = TRUE;
if (BluetoothSelectDevices(&pbtsdp))
{
BLUETOOTH_DEVICE_INFO *pbtdi = pbtsdp.pDevices;
BLUETOOTH_ADDRESS_STRUCT addr;
for (ULONG cDevices = 0; cDevices < pbtsdp.cNumDevices; cDevices++)
{
wcout.imbue(locale(""));
cout << "[Class]:0x" << uppercase << hex << pbtdi->ulClassofDevice;
wcout << ",[Name]:"<<wstring(pbtdi->szName) << "";
addr = pbtdi->Address;
cout <<",[Address]:0x"<<uppercase<< hex << addr.ullLong << endl;
}
BluetoothSelectDevicesFree(&pbtsdp);
}
_getch();
return 0;
}