BOOL CBCGPTagManager::ParseColor (const CString& strItem, CBCGPColor& value) { CBCGPTagManager tm (strItem); CStringArray sa; CString strA, strR, strG, strB; tm.ExcludeTag (s_A, strA); strA.TrimLeft (); strA.TrimRight (); tm.ExcludeTag (s_R, strR); strR.TrimLeft (); strR.TrimRight (); tm.ExcludeTag (s_G, strG); strG.TrimLeft (); strG.TrimRight (); tm.ExcludeTag (s_B, strB); strB.TrimLeft (); strB.TrimRight (); if (strR.IsEmpty () || strG.IsEmpty () || strB.IsEmpty ()) { if (!ParseString (strItem, _T(","), sa, TRUE, FALSE)) { strR = tm.GetBuffer (); strR.TrimLeft (); strR.TrimRight (); sa.Add (strR); } } else { sa.Add (strR); sa.Add (strG); sa.Add (strB); if (!strA.IsEmpty ()) { sa.Add (strA); } } if (sa.GetSize () > 0) { const int count = (int) sa.GetSize (); if (count >= 3) { value.r = bcg_clamp((double)_ttol(sa[0]) / 255.0, 0.0, 1.0); value.g = bcg_clamp((double)_ttol(sa[1]) / 255.0, 0.0, 1.0); value.b = bcg_clamp((double)_ttol(sa[2]) / 255.0, 0.0, 1.0); value.a = count == 4 ? bcg_clamp((double)_ttol(sa[3]) / 255.0, 0.0, 1.0) : 1.0; return TRUE; } } return FALSE; }
bool CDocCommands::ResizeTab(int iValue, LPCTSTR pSize) { CWaitCursor Wait; CImageObject* pObject = m_DocWindow.GetSelectedObject(); if (!pObject) { CMessageBox::NoObjectSelected(); return false; } CSize Size(0,0); if (iValue == EDIT_START) { } else if (iValue == EDIT_END) { } else if (iValue == EDIT_APPLY) { m_DocWindow.GetSelect().SuspendTracking(); CString strSize = pSize; int iIndex = strSize.Find(','); Size.cx = _ttol(strSize); Size.cy = _ttol(strSize.Mid(iIndex+1)); } else if (iValue == EDIT_RESET) { } else if (iValue >= 0) { } // Invalidate the image pre-edit m_DocWindow.InvalidateImage(pObject); bool bOK = pObject->ResizeTab(iValue, Size); // On Apply, we need to update the PageRect if (iValue == EDIT_APPLY) { bool bBaseObject = (pObject == m_DocWindow.GetBaseObject()); if (bBaseObject) m_DocWindow.SetPageRect(pObject, false/*bUnZoom*/); m_DocWindow.GetSelect().ResumeTracking(); } if (!bOK) return false; // Invalidate the image post-edit m_DocWindow.InvalidateImage(pObject); return true; }
////////////////////////////////////////////////////////////////////////////////////// // // 函数功能描述: // 输入: // 输出: // 返回值: // 其它说明: // ////////////////////////////////////////////////////////////////////////////////////// DWORD CWebService::SaveLastUpdateToMap(DWORD dwIndex,const CStdString &strData) { int ItemCount; CStdString szDelimiter; CStdString szDelimiter1; CStdString szTemp; TCHAR TempTch[30]; std::vector<CStdString> results; std::vector<CStdString> resultItem; szDelimiter=_T("(;0)"); szDelimiter1=_T("(;1)"); StringUtils StringUtil ; int nCount = StringUtil.SplitString(strData,szDelimiter,results,true); int intindex; if (nCount >= 2 ) { if (nCount > MAX_NET_COUNT_LASTUPDATED) nCount = MAX_NET_COUNT_LASTUPDATED; std::map<DWORD, T_ServerNetStationInfo*> *pMapLastUpdateTime = NULL; pMapLastUpdateTime=(std::map<DWORD, T_ServerNetStationInfo*>*)g_GlobalDataBlock->ReadRealData(E_ServerNetStationInfoGroup, dwIndex, E_PREPAREDATA_CLASS, eUseCommReadWithMulti); ASSERT(pMapLastUpdateTime != NULL); for(intindex=0;intindex<nCount-1;intindex++) { szTemp=results[intindex+2]; resultItem.clear() ; ItemCount = StringUtil.SplitString(szTemp, szDelimiter1,resultItem,true); //增加容错处理 if (ItemCount<1) { continue; } T_ServerNetStationInfo *pNetStationTime = new T_ServerNetStationInfo; ASSERT(pNetStationTime != NULL); _tcscpy(TempTch , resultItem[0]); pNetStationTime->dwNsCode = _ttol(TempTch); _tcscpy(TempTch , resultItem[1]); pNetStationTime->dwLastUpdateTime = _ttol(TempTch); (*pMapLastUpdateTime)[pNetStationTime->dwNsCode] = pNetStationTime; } } return BIZMC_OK; }
/** * CSC_LookupBreakpointList * * @return CBreakpointList* * @exception - * @see */ CBreakpointList *CSC_LookupBreakpointList(LPCTSTR clsName) { CObject *val; if (s_MapBreakpoints.Lookup(clsName, val)) { return (CBreakpointList*)val; } CBreakpointList *retval = new CBreakpointList; s_MapBreakpoints.SetAt(clsName, retval); CCsvParse parser; CString filename = GetConfigPath() + clsName + _T(".dbp"); HRESULT hr = parser.Open(filename); if (FAILED(hr)) { FC_DEBUGPRINT1(_T("CSVPARS> file not found: %s\n"), filename); TrcPrint(TRC_ERROR, _T("CSVPARS> file not found: %s\n"), filename); return retval; } BOOL syntax = TRUE; for (;;) { CSC_BREAKPOINT line; CString str; if (!parser.IsEndOfLine()) { syntax = FALSE; break; } BOOL ok = parser.ParseNextField(str); if (!ok) break; line.bpnr = _ttol(str); syntax = parser.ParseNextField(str); if (!syntax) break; line.offset = _ttol(str); syntax = parser.ParseNextField(str); // 'I' | 'N' if (!syntax) break; if (str.CompareNoCase(_T("I")) && str.CompareNoCase(_T("N")) ) continue; if (str.CompareNoCase(_T("N")) == 0) line.type = 1; // NATIVE CODE else line.type = 0; // INTERPRETER retval->AddTail(line); } if (!syntax) { FC_DEBUGPRINT3(_T("CSVPARS> syntax error in %s(%d:%d)\n"), filename, parser.GetLineNo(), parser.GetLinePos()); TrcPrint(TRC_ERROR, _T("CSVPARS> syntax error in %s(%d:%d)\n"), filename, parser.GetLineNo(), parser.GetLinePos()); } return retval; }
void CBlockData::ExtraTargetsFromSource(CStdString &strData) { std::vector<CStdString> vecBlockData ; int nSize = SplitStringWithSeparator(strData ,ENCODE_SEPARATOR , vecBlockData) ; int i = 0 ; //解封StepData begin-- if ( i<nSize ) { CStdString strStepData = Decode( vecBlockData[i++] ) ; std::vector<CStdString> vecStepData ; if ( !strStepData.IsEmpty() ) { int nCount = SplitStringWithSeparator(strStepData , ENCODE_SEPARATOR , vecStepData) ; for (int j=0 ; j<nCount ; ++j) { CStepData stepDataTmp ; stepDataTmp.SetSource( vecStepData[j] ) ; m_vobjTargetData.push_back(stepDataTmp) ; } } } //--end 解封StepData if ( i<nSize ) { m_lngActiveObject = _ttol( Decode(vecBlockData[i++]) ) ; } if ( i<nSize) { m_lngPerWait = _ttol( Decode(vecBlockData[i++]) ) ; } if ( i<nSize ) { m_bFaultTolerant = _ttoi( Decode(vecBlockData[i++]) ) ; } if ( i<nSize ) { m_bLoopFlag = _ttoi( Decode(vecBlockData[i++]) ) ; } if ( i<nSize ) { m_strDescription = Decode(vecBlockData[i++]) ; m_strDescription.Replace(_T("&b"), _T(",")) ; } if ( i<nSize ) { m_tLoopSetting.SetSource( Decode(vecBlockData[i++]) ) ; } if ( i<nSize ) { m_tJumpSetting.SetSource(Decode(vecBlockData[i++])); } }
void CuDlgPropertyPageEventNotify::UpdateSetting(BOOL bOut) { if (bOut) { if (!m_bInitDialog) return; CxDlgPropertySheetPreference* pParent = (CxDlgPropertySheetPreference*)GetParent(); theApp.m_setting.SetEventMaxType(m_nEventMaxType); theApp.m_setting.m_nMaxEvent = _ttol (m_strMaxEvent); theApp.m_setting.m_nMaxMemUnit = _ttol (m_strMaxMemory); theApp.m_setting.m_nMaxDay = _ttol(m_strSinceDays); theApp.m_setting.m_bSendingMail= m_bSendingMail; theApp.m_setting.m_bMessageBox = m_bMessageBox; theApp.m_setting.m_bSoundBeep = m_bSoundBeep; } else { switch (theApp.m_setting.GetEventMaxType()) { case EVMAX_MEMORY: m_nEventMaxType = IDC_RADIO1; break; case EVMAX_COUNT: m_nEventMaxType = IDC_RADIO2; break; case EVMAX_SINCEDAY: m_nEventMaxType = IDC_RADIO3; break; case EVMAX_SINCENAME: m_nEventMaxType = IDC_RADIO4; break; case EVMAX_NOLIMIT: m_nEventMaxType = IDC_RADIO5; break; default: m_nEventMaxType = IDC_RADIO5; break; } m_bSendingMail = theApp.m_setting.m_bSendingMail; m_bMessageBox = theApp.m_setting.m_bMessageBox; m_bSoundBeep = theApp.m_setting.m_bSoundBeep; m_strMaxEvent.Format (_T("%d"), theApp.m_setting.m_nMaxEvent); m_strMaxMemory.Format (_T("%d"), theApp.m_setting.m_nMaxMemUnit); m_strSinceDays.Format (_T("%d"), theApp.m_setting.m_nMaxDay); } }
void CuDlgReplicationStaticPageActivity::UpdateDbTotal (int iColumn, LPRAISEDREPLICDBE pData) { int iFound = -1; LVFINDINFO lvfind; enum {DB_INSERT = 1, DB_UPDATE, DB_DELETE, DB_TOTAL, DB_TRANSACTION}; LONG lNumber; CString strItem; // // Update the Total per Database. CuListCtrl& listctrlTotalDb = m_pDatabaseTotal->m_cListCtrl; memset (&lvfind, 0, sizeof (lvfind)); lvfind.flags = LVFI_STRING; lvfind.psz = (LPTSTR)pData->DBName; iFound = listctrlTotalDb.FindItem (&lvfind); if (iFound != -1) { // // Existing Database strItem = listctrlTotalDb.GetItemText (iFound, iColumn); lNumber = _ttol ((LPCTSTR)strItem); lNumber++; strItem.Format (_T("%ld"), lNumber); listctrlTotalDb.SetItemText (iFound, iColumn, strItem); // // Exclude the Transaction: if (iColumn != DB_TRANSACTION) { strItem = listctrlTotalDb.GetItemText (iFound, DB_TOTAL); lNumber = _ttol ((LPCTSTR)strItem); lNumber++; strItem.Format (_T("%ld"), lNumber); listctrlTotalDb.SetItemText (iFound, DB_TOTAL, strItem); } } else { // // New Database int nNewItem = listctrlTotalDb.InsertItem (listctrlTotalDb.GetItemCount(), (LPCTSTR)pData->DBName); listctrlTotalDb.SetItemText (nNewItem, DB_INSERT, _T("0")); listctrlTotalDb.SetItemText (nNewItem, DB_UPDATE, _T("0")); listctrlTotalDb.SetItemText (nNewItem, DB_DELETE, _T("0")); if (iColumn != DB_TRANSACTION) listctrlTotalDb.SetItemText (nNewItem, DB_TOTAL, _T("1")); listctrlTotalDb.SetItemText (nNewItem, DB_TRANSACTION, _T("0")); listctrlTotalDb.SetItemText (nNewItem, iColumn , _T("1")); } }
bool POP3Connection::_ProtocolDELE(const String &Parameter) { String sInputParam; sInputParam = Parameter; sInputParam.TrimLeft(); sInputParam.TrimRight(); long lMessageID = _ttol(sInputParam); if (!_account) { _SendData("-ERR No such message (messages not loaded)"); return true; } shared_ptr<Message> message = _GetMessage(lMessageID); if (message) { message->SetFlagDeleted(true); _SendData("+OK msg deleted"); } else _SendData("-ERR No such message"); return true; }
bool PowerDocsExtHelper::GetPreviousVersion(const DOCSObjects::IVersionPtr pVersion,DOCSObjects::IVersionPtr& pPrevVersion) { if(pVersion == NULL) return false; pPrevVersion = NULL; _bstr_t bstrLabel; bstrLabel= pVersion->GetVersionLabel(); CStdString sLabel = bstrLabel; long lVersion = _ttol(sLabel.c_str()); if(lVersion == 1) return false; DOCSObjects::IProfilePtr pProfile = pVersion->GetProfile(); if(pProfile == NULL) return false; DOCSObjects::IVersionsPtr pVersions; HRESULT hr = pProfile->get_Versions(&pVersions); if(SUCCEEDED(hr)) { TCHAR tmp[5]; _variant_t varIndex = _ltot(lVersion-1, tmp, 10); //Previous version pPrevVersion = pVersions->GetItem(varIndex); return true; } return false; }
BOOL CApp::LoadBadlink() { LPCTSTR pVal; //get the url if it is not NULL pVal = g_pConfig->GetAppSettingPtr(m_pbStruct.iTabID,L"Navigation\\BadLinkURI",L"Value"); if(pVal){ int iLen = _tcslen(pVal); if(iLen==0) return TRUE;//not an error badlink not set in config if(iLen > 5 && iLen<= MAX_URL){ _tcscpy(m_szBadLinkURI,pVal); pVal = g_pConfig->GetSettingPtr(L"Configuration\\Navigation\\NavTimeout",L"Value"); if(pVal){ m_dwNavTimeoutMs = _ttol(pVal); m_bBadlink = TRUE; if(m_dwNavTimeoutMs >= 0 && m_dwNavTimeoutMs < 45001) { // Badlink value is in Range } else { Log(PB_LOG_WARNING, L"Navigation timeout provided in configuration file is out of range, defaulting to 45000 ms", _T(__FUNCTION__), __LINE__, L"Core"); m_dwNavTimeoutMs = 45000; } return TRUE; } } } return FALSE; }
DWORD CPluginsDlg::GetSelectedPluginID() { for(int i = 0; i < m_cList.GetItemCount(); ++i) { const UINT uState = m_cList.GetItemState(i, LVIS_SELECTED); if((uState & LVIS_SELECTED) != 0) { TCHAR tszBuf[13]; ZeroMemory(&tszBuf[0], 13 * sizeof(TCHAR)); LV_ITEM lvi; ZeroMemory(&lvi, sizeof(LV_ITEM)); lvi.iItem = i; lvi.iSubItem = 3; lvi.mask = LVIF_TEXT; lvi.pszText = tszBuf; lvi.cchTextMax = 12; m_cList.GetItem(&lvi); return static_cast<DWORD>(_ttol(lvi.pszText)); } } return DWORD_MAX; }
// オペレーション BOOL CEditChannelDlg::SetAmountRange () { CButton* pByTrackUnitButton = (CButton*)GetDlgItem (IDC_EDITCHANNEL_BYTRACKUNIT); CButton* pAbsoluteUnitButton = (CButton*)GetDlgItem (IDC_EDITCHANNEL_ABSOLUTEUNIT); CButton* pRelativeUnitButton = (CButton*)GetDlgItem (IDC_EDITCHANNEL_RELATIVEUNIT); CString strValue; GetDlgItem (IDC_EDITCHANNEL_AMOUNT)->GetWindowText (strValue); long lValue = _ttol (strValue); if (pByTrackUnitButton->GetCheck ()) { ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNT))->EnableWindow (FALSE); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNTSP))->EnableWindow (FALSE); } else if (pAbsoluteUnitButton->GetCheck ()) { ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNT))->EnableWindow (TRUE); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNTSP))->EnableWindow (TRUE); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNTSP))->SetRange (1, 16); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNTSP))->SetPos (CLIP (1, lValue, 16)); } else if (pRelativeUnitButton->GetCheck ()) { ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNT))->EnableWindow (TRUE); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNTSP))->EnableWindow (TRUE); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNTSP))->SetRange (-15, 15); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITCHANNEL_AMOUNTSP))->SetPos (CLIP (-15, lValue, 15)); } return TRUE; }
BOOL CEditValueDlg::SetAmountRange () { CButton* pAbsoluteUnitButton = (CButton*)GetDlgItem (IDC_EDITVALUE_ABSOLUTEUNIT); CButton* pRelativeUnitButton = (CButton*)GetDlgItem (IDC_EDITVALUE_RELATIVEUNIT); CButton* pTargetPitchBendButton = (CButton*)GetDlgItem (IDC_EDITVALUE_TARGETPITCHBEND); CString strValue; GetDlgItem (IDC_EDITVALUE_AMOUNT)->GetWindowText (strValue); long lValue = _ttol (strValue); if (pAbsoluteUnitButton->GetCheck ()) { if (pTargetPitchBendButton->GetCheck ()) { ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetRange (-8192, 8191); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetPos (CLIP (-8192, lValue, 8191)); } else { ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetRange (0, 127); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetPos (CLIP (0, lValue, 127)); } } else if (pRelativeUnitButton->GetCheck ()) { if (pTargetPitchBendButton->GetCheck ()) { ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetRange (-16384, 16383); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetPos (CLIP (-16384, lValue, 16383)); } else { ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetRange (-127, 127); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetPos (CLIP (-127, lValue, 127)); } } else { ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetRange (0, 1000); ((CSpinButtonCtrl*)GetDlgItem (IDC_EDITVALUE_AMOUNTSP))->SetPos (CLIP (0, lValue, 1000)); } return TRUE; }
//修改陣列值 void CLaserAdjust::LaserAdjustModify() { for (UINT i = 0; i < ((CCommandTestDlg*)pMain)->a.LaserAdjust.size(); i++) { ((CCommandTestDlg*)pMain)->a.LaserAdjust.at(i).LaserMeasureHeight = _ttol(m_ListLaserAdjust.GetItemText(i, 1)); } }
time_t COptDownloadPackage::getTimeStamp() { CString csFilename, csTimestamp; // Check if not already retrieved from file if (m_tTimePack != 0) return m_tTimePack; try { // Load "since" file content csFilename.Format(_T("%s\\%s\\%s"), getDownloadFolder(), m_csId, OCS_DOWNLOAD_TIMESTAMP); if (!LoadFileToText(csTimestamp, csFilename)) { m_tTimePack = 0; return m_tTimePack; } m_tTimePack = (time_t)_ttol(csTimestamp); } catch (CException *pEx) { pEx->Delete(); m_tTimePack = 0; } return m_tTimePack; }
/*************************************************** OnLClicked - overloaded CUGCellType::OnLClicked Checks to see if the slider has been clicked on. If the mouse button is pressed over the slider, then the slider is put into a interactive update state. Once the mouse button is release the interactive update state is turned off **See CUGCellType::OnLClicked for more details about this function ****************************************************/ BOOL CUGSliderType::OnLClicked(int col,long row,int updn,RECT *rect,POINT *point){ if(updn) { m_updateSlider = FALSE; } CUGCell cell; m_ctrl->GetCell(col,row,&cell); //get the slider percentage int percent = 0; if(cell.IsPropertySet(UGCELL_STRING_SET)) percent = _ttol(cell.GetText()); //get the percent if(percent >100) percent = 100; else if(percent <0) percent = 0; //find the slider x position long width = rect->right - rect->left - 6; int xPos = rect->left + 3 + ((width * percent) / 100); int mouseX = point->x; if(mouseX > xPos- 6 && mouseX < xPos+6) { m_updateSlider = TRUE; return TRUE; } return FALSE; }
VOID CProcessManager::KillProcess() { CString csTemp; ULONG_PTR ulProcessId = 0; BOOL bRet = FALSE; BOOL bOk = FALSE; DWORD dwReturnSize = 0; POSITION pos = m_List.GetFirstSelectedItemPosition(); while(pos) { int nItem = m_List.GetNextSelectedItem(pos); csTemp = m_List.GetItemText(nItem,1); ulProcessId = _ttol(csTemp); bRet = DeviceIoControl(g_hDevice,CTL_KILLPROCESS, &ulProcessId, sizeof(ULONG_PTR), NULL, 0, &dwReturnSize, NULL); if(bRet) { m_List.DeleteItem(nItem); } } }
void CIbnCommandWnd::SendFile(CComPtr<IXMLDOMNode> &pRootNode) { USES_CONVERSION; CComBSTR bsTmpFileName; CComPtr<IXMLDOMNode> pFileNode; pRootNode->selectSingleNode(CComBSTR(L"request/file"),&pFileNode); if(pFileNode==NULL) return; pFileNode->get_text(&bsTmpFileName); CComPtr<IXMLDOMNodeList> pRecipientIdNodeList = NULL; pRootNode->selectNodes(CComBSTR(L"request/recipients/id"),&pRecipientIdNodeList); if(pRecipientIdNodeList==NULL) return; SendFileInfo *pSendFileInfo = new SendFileInfo(); long listLength = 0; pRecipientIdNodeList->get_length(&listLength); CString strRecepientId = _T(""); for(int index=0; index<listLength; index++) { CComBSTR bsUserId; CComPtr<IXMLDOMNode> pIdNode = NULL; pRecipientIdNodeList->get_item(index,&pIdNode); pIdNode->get_text(&bsUserId); strRecepientId = W2CT(bsUserId); pSendFileInfo->RecepientID += strRecepientId; pSendFileInfo->RecepientID += _T(","); } if(listLength==1) { int globalId = _ttol(strRecepientId); CUser user; if(pMessenger->GetUserByGlobalId(globalId, user)) { pSendFileInfo->RecepientName = user.GetShowName(); } else pSendFileInfo->RecepientName = _T("Screen Capture User Group"); } else pSendFileInfo->RecepientName = _T("Screen Capture User Group"); pSendFileInfo->Description = GetString(IDS_SCREEN_CAPTURE_NAME); pSendFileInfo->File = W2CT(bsTmpFileName); pMessenger->PostMessage(WM_SEND_FILE2, (WPARAM)pSendFileInfo); }
void CForceSyncDlg::OnOK() { m_WinPos.SaveWindowPosition(); UpdateData( ); if (m_Action == 1) { if (IDYES != AfxMessageBox(IDS_ASK_FORCE_RESYNC, MB_YESNO | MB_ICONQUESTION)) return; } else { int index=m_ChangeCombo.GetCurSel(); CString txt; m_ChangeCombo.GetLBText(index, txt); if(txt.Compare(LoadStringResource(IDS_DEFAULTCHANGELISTNAME)) == 0) m_SelectedChange= 0; else if(txt.Compare(LoadStringResource(IDS_NEWCHANGELISTNAME)) == 0) { m_SelectedChange= MainFrame()->CreateNewChangeList(m_Key); if (m_SelectedChange == -1) // the user bailed return; } else m_SelectedChange=_ttol(txt); } CDialog::OnOK(); }
BOOL CSC_ReverseLookupTask(long taskid, CString &name) { CCsvParse parser; CString filename = GetConfigPath() + pszTasksFileName; HRESULT hr = parser.Open(filename); if (FAILED(hr)) { FC_DEBUGPRINT1(_T("CSVPARS> file not found: %s\n"), filename); TrcPrint(TRC_ERROR, _T("CSVPARS> file not found: %s\n"), filename); return FALSE; } BOOL syntax = TRUE; for (;;) { CString task, str_taskid,loaded; if (CConnection::GetFirmware() >= 20900 && CConnection::GetFirmware() < 21000) { // 04.04.06 SIS: do not check for end of line here (only for OSAI V2.09) } else { if (!parser.IsEndOfLine()) { syntax = FALSE; break; } } BOOL ok = parser.ParseNextField(task); if (!ok) break; task.MakeLower(); syntax = parser.ParseNextField(str_taskid); if (!syntax) break; if (CConnection::GetFirmware() >= 20700) { // Skip loaded/unloaded flag ok = parser.ParseNextField(loaded); if (!ok) break; } if (taskid == _ttol(str_taskid)){ name = task; return TRUE; } if (CConnection::GetFirmware() >= 20900 && CConnection::GetFirmware() < 21000) { parser.SkipLine(); // 04.04.06 SIS: skip rest of line } } if (!syntax) { FC_DEBUGPRINT3(_T("CSVPARS> syntax error in %s(%d:%d)\n"), filename, parser.GetLineNo(), parser.GetLinePos()); TrcPrint(TRC_ERROR, _T("CSVPARS> syntax error in %s(%d:%d)\n"), filename, parser.GetLineNo(), parser.GetLinePos()); } return FALSE; }
// チャンネル可変範囲設定 BOOL CPropertyNoteDlg::SetChannelRange () { CString strValue; GetDlgItem (IDC_PROPERTYNOTE_CHANNEL)->GetWindowText (strValue); long lValue = _ttol (strValue); ((CSpinButtonCtrl*)GetDlgItem (IDC_PROPERTYNOTE_CHANNELSP))->SetRange (1, 16); ((CSpinButtonCtrl*)GetDlgItem (IDC_PROPERTYNOTE_CHANNELSP))->SetPos (CLIP (1, lValue, 16)); return TRUE; }
DWORD CHisReport::GetTotal() const { if ( ! IsEnabled() ) return 0; CString strValue = m_pXML->GetAttributeValue( "Total" ); return _ttol( strValue ); }
// 離鍵ベロシティ可変範囲設定 BOOL CPropertyNoteDlg::SetOffVelocityRange () { CString strValue; GetDlgItem (IDC_PROPERTYNOTE_OFFVELOCITY)->GetWindowText (strValue); long lValue = _ttol (strValue); ((CSpinButtonCtrl*)GetDlgItem (IDC_PROPERTYNOTE_OFFVELOCITYSP))->SetRange (0, 127); ((CSpinButtonCtrl*)GetDlgItem (IDC_PROPERTYNOTE_OFFVELOCITYSP))->SetPos (CLIP (0, lValue, 127)); return TRUE; }
// 音長さ可変範囲設定 BOOL CPropertyNoteDlg::SetDurationRange () { CString strValue; GetDlgItem (IDC_PROPERTYNOTE_DURATION)->GetWindowText (strValue); long lValue = _ttol (strValue); ((CSpinButtonCtrl*)GetDlgItem (IDC_PROPERTYNOTE_DURATIONSP))->SetRange (1, 32767); ((CSpinButtonCtrl*)GetDlgItem (IDC_PROPERTYNOTE_DURATIONSP))->SetPos (CLIP (1, lValue, 32767)); return TRUE; }
long GetInt (LPCTSTR szSection, LPCTSTR szKey,long nDefault, short prodId) { string szKeyName = GetRegBase (prodId) + string(_T("\\")) + szSection; string retVal; if(!GetRegValue (g_AppKeyHive, szKeyName.c_str(),szKey, retVal,prodId)) return nDefault; return _ttol(retVal.c_str()); }
UINT DecStrToInt(LPCTSTR pDecText, int len) { int Val = 0; int iLen = lstrlen(pDecText); if(len > 0 && len < iLen) { ++len; CString text; LPTSTR ptext = text.GetBuffer(len); lstrcpyn(ptext, pDecText, len); Val = _ttol(ptext); text.ReleaseBuffer(); } else Val = _ttol(pDecText); return Val; }
long CXmlConfig::GetAttributeLong(const TCHAR* attributeName,long defValue,bool* pResult){ bool bRet=false; CString strDefaultValve; strDefaultValve.Format(_T("%d"),defValue); _tstring textValue=GetAttributeValue(attributeName,strDefaultValve,&bRet); if(pResult) (*pResult)=bRet; return bRet?_ttol(textValue.c_str()):defValue; }
//-------------------------------------------------------------------// // GetControlValue() // //-------------------------------------------------------------------// //-------------------------------------------------------------------// void ListDataLongEdit::ExtractControlValue() { CString strValue; GetWindowText( strValue ); CurrentMultiValue = _ttol( LPCTSTR( strValue ) ); }
void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) { if ( mir_tstrcmp( xmlGetAttrValue(iqNode, _T("type")), _T("result"))) return; HXML chatNode = xmlGetChild(iqNode, "chat"); if (!chatNode || mir_tstrcmp( xmlGetAttrValue(chatNode, _T("xmlns")), JABBER_FEAT_ARCHIVE)) return; const TCHAR* start = xmlGetAttrValue(chatNode, _T("start")); const TCHAR* with = xmlGetAttrValue(chatNode, _T("with")); if (!start || !with) return; MCONTACT hContact = HContactFromJID(with); time_t tmStart = str2time(start); if (hContact == 0 || tmStart == 0) return; _tzset(); for (int nodeIdx = 0; ; nodeIdx++) { HXML itemNode = xmlGetChild(chatNode, nodeIdx); if (!itemNode) break; int from; const TCHAR *itemName = xmlGetName(itemNode); if (!mir_tstrcmp(itemName, _T("to"))) from = DBEF_SENT; else if (!mir_tstrcmp(itemName, _T("from"))) from = 0; else continue; HXML body = xmlGetChild(itemNode, "body"); if (!body) continue; const TCHAR *tszBody = xmlGetText(body); const TCHAR *tszSecs = xmlGetAttrValue(itemNode, _T("secs")); if (!tszBody || !tszSecs) continue; ptrA szEventText( mir_utf8encodeT(tszBody)); DBEVENTINFO dbei = { sizeof(DBEVENTINFO) }; dbei.eventType = EVENTTYPE_MESSAGE; dbei.szModule = m_szModuleName; dbei.cbBlob = (DWORD)strlen(szEventText); dbei.flags = DBEF_READ + DBEF_UTF + from; dbei.pBlob = (PBYTE)(char*)szEventText; dbei.timestamp = tmStart + _ttol(tszSecs) - timezone; if (!IsDuplicateEvent(hContact, dbei)) db_event_add(hContact, &dbei); } }
bool CIMDocInfo::Parse(LPCTSTR szDocId) { LOG_WS_FUNCTION_SCOPE(); bool bRes = false; int iSize =(x64_int_cast) _tcslen(szDocId); if(iSize) { TCHAR* pBuffer = new TCHAR[iSize + 1]; if(pBuffer) { _tcscpy(pBuffer, szDocId); if (_tcschr(pBuffer, _T(':'))) { m_sServiceName = _tcstok(pBuffer,_T(":")); m_sServerName = _tcstok(NULL,_T("/")); } else { m_sServerName = _tcstok(pBuffer,_T("/")); } m_sDatabaseName = _tcstok(NULL,_T("/")); CStdString docNum = _tcstok(NULL,_T("/")); if(docNum.length() > 0) m_lDocNum = _ttol(docNum.c_str()); CStdString docVer = _tcstok(NULL,_T("/")); if(docVer.length() > 0) m_lVerNum = _ttol(docVer.c_str()); if((!m_sServerName.IsEmpty()) && (!m_sDatabaseName.IsEmpty()) && (m_lDocNum != 0) && (m_lVerNum != 0)) { bRes = true; } delete []pBuffer; } } return bRes; }