VC++编程通过Bluetooth API调用对话框选择蓝牙设备并显示设备信息


#include 
#include 
#include 
#include 
#include 
#include 

#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]:"<szName) << "";
			addr = pbtdi->Address;
			cout <<",[Address]:0x"<


你可能感兴趣的:(C/C++)