zoukankan      html  css  js  c++  java
  • 教程 | 蓝牙设备查找类CxBthRadio & CxBthRadioFind

    CxBthRadioFind的使用如下:

    void CUsbScannerDlg::OnBtnLocalBth() 
    {
        // TODO: Add your control notification handler code here
        m_list1.ResetContent();
        
        BTH_DEV_INFO bdi = {0};
        CString str;
        CxBthRadioFind finder;
        BOOL bRet = finder.FindRadio();
        while (bRet)
        {
            finder.GetDeviceInfo(&bdi);
            m_list1.AddString(bdi.szName);
            m_list1.AddString(bdi.szMacAddr);
            
            str.Format(_T("Class of Device : 0x%08x"), bdi.ulClassofDevice);
            m_list1.AddString(str);
    
            m_list1.AddString("");
            m_list1.AddString("-->Next<--");
            bRet = finder.FindNextRadio();
        }
        finder.FindRadioClose();
    }

    CxBthRadio的使用如下:

    void CUsbScannerDlg::OnBtnCurRemoteBthDev() 
    {
        // TODO: Add your control notification handler code here
        m_list1.ResetContent();
    
        BTH_DEV_INFO bdi = {0};
        BOOL bRetLocalFind, bRetRemoteFind;
        CString str;
        CxBthRadioFind local_bth_find;
        CxBthRadio local_bth;
    
        bRetLocalFind = local_bth_find.FindRadio(FALSE);
        while (bRetLocalFind)
        {
            local_bth.Attach(local_bth_find.GetRadioHandle());
    
            bRetRemoteFind = local_bth.FindRemoteDevice(FALSE);
            while (bRetRemoteFind)
            {
                local_bth.GetRemoteDeviceInfo(&bdi);
                m_list1.AddString(bdi.szName);
                m_list1.AddString(bdi.szMacAddr);
                
                str.Format(_T("Class of Device : 0x%08x"), bdi.ulClassofDevice);
                m_list1.AddString(str);
                
                m_list1.AddString("");
                m_list1.AddString("-->Next<--");
                bRetRemoteFind = local_bth.FindNextRemoteDevice();
            }
            local_bth.FindRemoteDeviceClose();
    
            local_bth_find.CloseRadioHandle();
    
            bRetLocalFind = local_bth_find.FindNextRadio(FALSE);
        }
        local_bth_find.FindRadioClose();
    }

      精练的代码不需要过多解释,你们懂的。To be continued...

    下载

    libComm - v1.2 For WinXP/Win7

  • 相关阅读:
    linux查看java jdk安装路径和设置环境变量
    linq where in 排序
    Console程序后台运行
    winform中文本框,软键盘跟随
    winform 应用log4net做日志记录到mysql
    c# 单实例运行
    Sql Server数据库监听 c#代码
    winform程序开机自动启动
    c# 连接mysql配置config,不用装net connector
    winform 不规则窗体无锯齿demo
  • 原文地址:https://www.cnblogs.com/EdmundDwyane/p/3292454.html
Copyright © 2011-2022 走看看