void OnSend(WndButton* pWnd) { if(ItemIndex < FileList.size()) { StartHourglassCursor(); //Start Bluetooth if needed... #ifdef UNDER_CE CObexPush Obex; if(Obex.Startup()) { StartupStore(_T("Startup OK \n")); size_t nDevice = Obex.LookupDevice(); StartupStore(_T("LookupDevice OK \n")); if(nDevice == 0) { StopHourglassCursor(); MessageBoxX(_T("No Device"), _T("Error"), mbOk); StartHourglassCursor(); } else { WndProperty* wp = (WndProperty*)wfDlg->FindByName(TEXT("prpDeviceList")); DataFieldEnum* dfe = NULL; if (wp) { dfe = (DataFieldEnum*)wp->GetDataField(); } if(dfe) { dfe->Clear(); dfe->addEnumText(_T("none")); } for(size_t i = 0; i < nDevice; ++i) { TCHAR szDeviceName[100] = {0}; if(!Obex.GetDeviceName(i, szDeviceName, array_size(szDeviceName))) { _stprintf(szDeviceName, _T("Unknown device <%d>"), i); } StartupStore(_T("GetDeviceName <%d><%s> \n"), i, szDeviceName); if(dfe) { dfe->addEnumText(szDeviceName); } } if(wp) { if(dfe) { dfe->SetAsInteger(0); } wp->SetReadOnly(false); wp->RefreshDisplay(); } StopHourglassCursor(); size_t DeviceIndex = 0; if(dfe && wp) { dlgComboPicker(wp); DeviceIndex = dfe->GetAsInteger(); } StartHourglassCursor(); if(DeviceIndex != 0) { DeviceIndex--; TCHAR szFileFullPath[MAX_PATH] = _T("\0"); LocalPath(szFileFullPath, _T(LKD_LOGS)); size_t nLen = _tcslen(szFileFullPath); if (szFileFullPath[nLen - 1] != _T('\\')) { _tcscat(szFileFullPath, _T("\\")); } FileList_t::const_iterator ItFileName = FileList.begin(); std::advance(ItFileName, ItemIndex); _tcscat(szFileFullPath, ItFileName->c_str()); if(!Obex.SendFile(DeviceIndex, szFileFullPath)) { StopHourglassCursor(); MessageBoxX(_T("Send Failed"), _T("Error"), mbOk); StartHourglassCursor(); } else { StopHourglassCursor(); MessageBoxX(_T("File sent!"), _T("Success"), mbOk); StartHourglassCursor(); } } } Obex.Shutdown(); } else { MessageBoxX(_T("Unsupported on this device"), _T("Error"), mbOk); } #else MessageBoxX(_T("Unsupported on this device"), _T("Error"), mbOk); #endif StopHourglassCursor(); } }