謝欣倫-化繁為簡シリーズオリジナルチュートリアル-通信特集-Bluetoothデバイス検索クラスCxBthRemoteDeviceFind

2146 ワード

これは精巧なBluetoothデバイス検索クラスで、クラス名、関数名、変数名はハンガリー命名法を採用しています.小文字のxは私の姓の頭文字(謝欣倫)を代表して、個人の習慣だけで、同じように、偶然です.
CxBthRemoteDeviceFindの使用は以下の通りです.
void CUsbScannerDlg::OnBtnRemoteBth() 

{

    // TODO: Add your control notification handler code here

    m_list1.ResetContent();



    BTH_DEV_INFO bdi = {0};

    CString str;

    CxBthRemoteDeviceFind finder; BOOL bRet = finder.FindDevice(); 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.FindNextDevice();

        

    }        

    finder.Close();

}

洗練されたコードはあまり説明する必要はありません.あなたたちは知っています.To be continued...
ダウンロード
libComm - v1.2 For WinXP/Win7