void CAipi_RETE_NCCNode::printNCCPartnerN_TK() { CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd(); TCHAR buffer[16]; pMainFrame->m_wndOutputTabView.AddMsg1(_T("******* NOT Node - Token *******")); //Print map container for( CMainFrame::g_mmNCCPartnerN_TK::const_iterator iter = pMainFrame->gmmNCCPartnerN_TK.begin(); iter!= pMainFrame->gmmNCCPartnerN_TK.end(); ++iter) { CString strNCC =_T("NCC"); CString strTK =_T("T"); pMainFrame->m_wndOutputTabView.AddMsg1(_T("******* NCC Node - Token *******")); strNCC += _itot( iter->first, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strNCC); strTK += _itot( iter->second, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strTK); } }
void CAipi_RETE_NNode::printWM_NN() { CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd(); TCHAR buffer[16]; pMainFrame->m_wndOutputTabView.AddMsg1(_T("******* Working Memory - NOT Node *******")); //Print map container for( CMainFrame::g_mWM_NN::const_iterator iter = pMainFrame->gmWM_NN.begin(); iter!= pMainFrame->gmWM_NN.end(); ++iter) { CString strWM =_T("WM"); CString strNOT =_T("NOT"); pMainFrame->m_wndOutputTabView.AddMsg1(_T("******* WME - NOTNode *******")); strWM += _itot( iter->first, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strWM); strNOT += _itot( iter->second, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strNOT); } }
/// <summary> /// Loads the satellite DLL for the specified language from subdirectories /// named with decimal LCID. /// </summary> /// <param name="langDesired">Desired language.</param> /// <param name="lpszBaseDir">Directory with all the language subdirectories.</param> /// <param name="lpszSatName">Name of the satellite DLL.</param> /// <returns>Handle to the satellite DLL.</returns> HMODULE LoadSatelliteDLL(LANGID langDesired, LPCTSTR lpszBaseDir, LPCTSTR lpszSatName) { TCHAR szSatellitePath[MAX_PATH]; TCHAR szBuffer[12]; HMODULE hMod; // check string lengths if (lstrlen(lpszBaseDir) + lstrlen(lpszSatName) + 15 <= MAX_PATH) { // try to load the library with the fully specified language _itot(langDesired, szBuffer, 10); wsprintf(szSatellitePath, _T("%s\\%s\\%s"), lpszBaseDir, szBuffer, lpszSatName); hMod = LoadLibrary(szSatellitePath); if (NULL != hMod) { return hMod; } else { // no luck, try the primary language ID langDesired = PRIMARYLANGID(langDesired); _itot(langDesired, szBuffer, 10); wsprintf(szSatellitePath, _T("%s\\%s\\%s"), lpszBaseDir, szBuffer, lpszSatName); hMod = LoadLibrary(szSatellitePath); if (NULL != hMod) { return hMod; } } } return NULL; }
void CAipi_RETE_Operations::printOperation() { CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd(); TCHAR buffer[16]; pMainFrame->m_wndOutputTabView.AddMsg1(_T("******* Production Memory - Operations *******")); //Print map container for( CMainFrame::g_mmPM_Operation::const_iterator iter = pMainFrame->gmmPM_Operation.begin(); iter!= pMainFrame->gmmPM_Operation.end(); ++iter) { CString strPM =_T("P"); CString strCond =_T("C"); CString strType1 =_T("LEFT_TYPE_"); CString strType2 =_T("RIGHT_TYPE_"); CString strRel =_T("REL_"); pMainFrame->m_wndOutputTabView.AddMsg1(_T("******* PM - Operation *******")); pMainFrame->m_wndOutputTabView.AddMsg1(_T("PM: ")); strPM += _itot( iter->first, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strPM); CAipi_RETE_Operations op = (CAipi_RETE_Operations)iter->second; int c = op.getCond(); tstring v1 = op.getLeftVar(); tstring v2 = op.getRightVar(); int type1 = op.getLeftType(); int type2 = op.getRightType(); int rel = op.getRel(); pMainFrame->m_wndOutputTabView.AddMsg1(_T("Condition: ")); strCond += _itot( c, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strCond); pMainFrame->m_wndOutputTabView.AddMsg1(_T("Left Variable: ")); pMainFrame->m_wndOutputTabView.AddMsg1(v1.data()); pMainFrame->m_wndOutputTabView.AddMsg1(_T("Right Variable: ")); pMainFrame->m_wndOutputTabView.AddMsg1(v2.data()); pMainFrame->m_wndOutputTabView.AddMsg1(_T("Left Type: ")); strType1 += _itot( type1, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strType1); pMainFrame->m_wndOutputTabView.AddMsg1(_T("Right Type: ")); strType2 += _itot( type2, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strType2); pMainFrame->m_wndOutputTabView.AddMsg1(_T("Rel: ")); strRel += _itot( rel, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strRel); } }
void CAipi_RETE_Links::printCondLink() { CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd(); TCHAR buffer[16]; pMainFrame->m_wndOutputTabView.AddMsg1(_T("******* Links Conditions Order *******")); //Print map container for( CMainFrame::g_mmLink::const_iterator iter = pMainFrame->gmmLink.begin(); iter!= pMainFrame->gmmLink.end(); ++iter) { CString strCond =_T("C"); CString strField =_T("F"); CString strPM = _T("PM"); pMainFrame->m_wndOutputTabView.AddMsg1(_T("******* Linked Cond1 - Cond2 *******")); pMainFrame->m_wndOutputTabView.AddMsg1(_T("***) Condition 1: ")); strCond += _itot( iter->first, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strCond); CAipi_RETE_Links lko = (CAipi_RETE_Links)iter->second; int f1 = lko.getField1(); int c2 = lko.getCond2(); int f2 = lko.getField2(); int pm = lko.getPM(); tstring var = lko.getVar(); pMainFrame->m_wndOutputTabView.AddMsg1(_T("***) Field1: ")); strField += _itot( f1, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strField); strCond =_T("C"); pMainFrame->m_wndOutputTabView.AddMsg1(_T("***) Condition 2: ")); strCond += _itot( c2, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strCond); strField = _T("F"); pMainFrame->m_wndOutputTabView.AddMsg1(_T("***) Field2: ")); strField += _itot( f2, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strField); pMainFrame->m_wndOutputTabView.AddMsg1(_T("***) PM: ")); strPM += _itot( pm, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strPM); pMainFrame->m_wndOutputTabView.AddMsg1(_T("***) Variable: ")); pMainFrame->m_wndOutputTabView.AddMsg1(var.data()); } }
/** * This method adds a row to the listview. * * @param hContact - contact to add the line for * @param pszProto - contact's protocol * @param ad - anniversary to add * @param mtNow - current time * @param wDaysBefore - number of days in advance to remind the user of the anniversary * * @retval TRUE if successful * @retval FALSE if failed **/ BYTE AddRow(MCONTACT hContact, LPCSTR pszProto, MAnnivDate &ad, MTime &mtNow, WORD wDaysBefore) { TCHAR szText[MAX_PATH]; int diff, iItem = -1; CItemData *pdata; // first column: ETA diff = ad.CompareDays(mtNow); if (diff < 0) diff += IsLeap(mtNow.Year() + 1) ? 366 : 365; // is filtered if (diff <= _filter.wDaysBefore) { // read reminder options for the contact ad.DBGetReminderOpts(hContact); if ((_filter.bFilterIndex != FILTER_DISABLED_REMINDER) || (ad.RemindOption() == BST_UNCHECKED)) { // set default offset if required if (ad.RemindOffset() == (WORD)-1) { ad.RemindOffset(wDaysBefore); // create data object pdata = new CItemData(hContact, ad); if (!pdata) return FALSE; // add item iItem = AddItem(_itot(diff, szText, 10), (LPARAM)pdata); if (iItem == -1) { delete pdata; return FALSE; } // second column: contact name AddSubItem(iItem, COLUMN_CONTACT, DB::Contact::DisplayName(hContact)); // third column: protocol TCHAR *ptszProto = mir_a2t(pszProto); AddSubItem(iItem, COLUMN_PROTO, ptszProto); mir_free(ptszProto); // forth line: age if (ad.Age(&mtNow)) AddSubItem(iItem, COLUMN_AGE, _itot(ad.Age(&mtNow), szText, 10)); else AddSubItem(iItem, COLUMN_AGE, _T("???")); // fifth line: anniversary AddSubItem(iItem, COLUMN_DESC, (LPTSTR)ad.Description()); // sixth line: date ad.DateFormatAlt(szText, _countof(szText)); AddSubItem(iItem, COLUMN_DATE, szText); _numRows++; } } } return TRUE; }
void CTaggingPP::UpdateScrollers() { TCHAR bf[20]; _itot(m_rdAuto.GetPos() * 5, bf, 10); SetDlgItemText(IDC_EDT_RD_AUTO, bf); _itot(m_rdManual.GetPos() * 5, bf, 10); SetDlgItemText(IDC_EDT_RD_MANUAL, bf); OnChange(); }
void TfrmMain::edtSizeUpdate(RECT rect, HWND hTarget, UINT Ctrl) { TCHAR B[33], H[16]; // _itot_s(ABS(rect.right - rect.left), B, 33, 10); _itot(ABS(rect.right - rect.left), B, 10); // _itot_s(ABS(rect.bottom - rect.top), H, 16, 10); _itot(ABS(rect.bottom - rect.top), H, 10); mir_tcsncat(B, _T("x"), 33); mir_tcsncat(B, H, 33); SetDlgItemText(hTarget, Ctrl, B); }
/** * name: OnReminderChecked * class: CAnnivEditCtrl * desc: is called if reminder checkbox's state was changed * param: none * return: nothing **/ void CAnnivEditCtrl::OnReminderChecked() { MCONTACT hContact; LPCSTR pszProto; int state; TCHAR buf[6]; MAnnivDate *pCurrent = Current(); PSGetContact(_hwndDlg, hContact); if (!hContact || !PSGetBaseProto(_hwndDlg, pszProto) || !pCurrent) { EnableReminderCtrl(FALSE); } else { if (IsDlgButtonChecked(_hwndDlg, RADIO_REMIND1)) { _itot(db_get_b(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10); EnableWindow(GetDlgItem(_hwndDlg, EDIT_REMIND), FALSE); EnableWindow(GetDlgItem(_hwndDlg, SPIN_REMIND), FALSE); state = BST_INDETERMINATE; } else if (IsDlgButtonChecked(_hwndDlg, RADIO_REMIND2)) { if (pCurrent->RemindOffset() == (WORD)-1) { _itot(db_get_b(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), buf, 10); } else { _itot(pCurrent->RemindOffset(), buf, 10); } EnableWindow(GetDlgItem(_hwndDlg, EDIT_REMIND), _ReminderEnabled); EnableWindow(GetDlgItem(_hwndDlg, SPIN_REMIND), _ReminderEnabled); state = BST_CHECKED; } else { *buf = 0; EnableWindow(GetDlgItem(_hwndDlg, EDIT_REMIND), FALSE); EnableWindow(GetDlgItem(_hwndDlg, SPIN_REMIND), FALSE); state = BST_UNCHECKED; } if (pCurrent->RemindOption() != state) { pCurrent->RemindOption(state); if (!PspIsLocked(_hwndDlg)) { pCurrent->SetFlags(MAnnivDate::MADF_REMINDER_CHANGED); SendMessage(GetParent(_hwndDlg), PSM_CHANGED, NULL, NULL); } } SetDlgItemText(_hwndDlg, EDIT_REMIND, buf); } }
void CMapFunctionProperties::PrintMap() { CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd(); CObject *pNext; CFunctionProperties *pCurrent = NULL; POSITION pos; TCHAR buffer[8]; if( GetCount() == 0 ) { pMainFrame->m_wndOutputTabView.AddMsg1(_T("FunctionProperties Map is Empty")); } else { pMainFrame->m_wndOutputTabView.AddMsg1(_T("*** FUNCTION PROPERTIES MAP ***")); pos = GetStartPosition(); while( pos != NULL ) { CString ref = _T("REF_"); CString strItem = _T("ITEM_"); CString strFile = _T("FILE_"); CString strPath = _T("PATH_"); CString strLang = _T("LANG"); CString strRType = _T("RETURN_TYPE"); GetNextAssoc(pos, ref, pNext); pCurrent = (CFunctionProperties *) pNext; pMainFrame->m_wndOutputTabView.AddMsg1(ref); HTREEITEM hItem = pCurrent->getItem(); int item = (int )hItem; strItem += _itot( item, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strItem); strFile += (const TCHAR *)pCurrent->getFile(); pMainFrame->m_wndOutputTabView.AddMsg1(strFile); strPath += (const TCHAR *)pCurrent->getPath(); pMainFrame->m_wndOutputTabView.AddMsg1(strPath); int lang = pCurrent->getLanguage(); strLang = _itot( lang, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strLang); int rtype = pCurrent->getReturnType(); strRType = _itot( rtype, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strRType); pMainFrame->m_wndOutputTabView.AddMsg1(_T("************************")); } } }
int SetDlgState(HWND hwndDlg) { TCHAR buff[10]; if (new_options.backup_types == BT_DISABLED) { CheckDlgButton(hwndDlg, IDC_RAD_DISABLED, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_DISABLED), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ED_NUMBACKUPS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ED_FOLDER), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_BUT_BROWSE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_LNK_FOLDERS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_NOPROG), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_NOPOPUP), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_USEZIP), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ED_PERIOD), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_PT), FALSE); CheckDlgButton(hwndDlg, IDC_RAD_START, BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_RAD_EXIT, BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_RAD_PERIODIC, BST_UNCHECKED); } else { EnableWindow(GetDlgItem(hwndDlg, IDC_RAD_DISABLED), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_ED_NUMBACKUPS), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_ED_FOLDER), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_BUT_BROWSE), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_LNK_FOLDERS), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_NOPROG), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_NOPOPUP), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_USEZIP), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_ED_PERIOD), new_options.backup_types & BT_PERIODIC); EnableWindow(GetDlgItem(hwndDlg, IDC_PT), new_options.backup_types & BT_PERIODIC); CheckDlgButton(hwndDlg, IDC_RAD_DISABLED, BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_RAD_START, new_options.backup_types & BT_START ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_RAD_EXIT, new_options.backup_types & BT_EXIT ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_RAD_PERIODIC, new_options.backup_types & BT_PERIODIC ? BST_CHECKED : BST_UNCHECKED); } SendDlgItemMessage(hwndDlg, SPIN_PERIOD, UDM_SETRANGE32, 1, (LPARAM)60); SetDlgItemText(hwndDlg, IDC_ED_PERIOD, _itot(new_options.period, buff, 10)); SendDlgItemMessage(hwndDlg, SPIN_NUMBACKUPS, UDM_SETRANGE32, 1, (LPARAM)100); SetDlgItemText(hwndDlg, IDC_ED_NUMBACKUPS, _itot(new_options.num_backups, buff, 10)); SetDlgItemText(hwndDlg, IDC_ED_FOLDER, new_options.folder); CheckDlgButton(hwndDlg, IDC_CHK_NOPROG, new_options.disable_progress ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_NOPOPUP, new_options.disable_popups ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_USEZIP, new_options.use_zip ? BST_CHECKED : BST_UNCHECKED); if (!ServiceExists(MS_POPUP_ADDPOPUPT)) ShowWindow(GetDlgItem(hwndDlg, IDC_CHK_NOPOPUP), SW_HIDE); return 0; }
void DataRecordsXmlSerializer::AppendXMLElement(IXmlWriter& xmlWriter, ArtistRecord& rec) { xmlWriter.WriteElementString(NULL, _T("artistname"), NULL, rec.name.c_str()); TCHAR bf[100]; _itot(rec.rating, bf, 10); xmlWriter.WriteElementString(NULL, _T("artistrating"), NULL, bf); if (rec.trackCount > 0) { _itot(rec.trackCount, bf, 10); xmlWriter.WriteElementString(NULL, _T("artisttrackcount"), NULL, bf); } }
void CMapVariableProperties::PrintMap() { CMainFrame* pMainFrame = (CMainFrame*)::AfxGetMainWnd(); CObject *pNext; CVariableProperties *pCurrent = NULL; POSITION pos; TCHAR buffer[8]; if( GetCount() == 0 ) { pMainFrame->m_wndOutputTabView.AddMsg1(_T("VariableProperties Map is Empty")); } else { pMainFrame->m_wndOutputTabView.AddMsg1(_T("*** VARIABLE PROPERTIES MAP ***")); pos = GetStartPosition(); while( pos != NULL ) { CString ref = _T("REF_"); CString strItem = _T("ITEM_"); CString strFile = _T("FILE_"); CString strPath = _T("PATH_"); CString strType = _T("TYPE_"); GetNextAssoc(pos, ref, pNext); pCurrent = (CVariableProperties *) pNext; pMainFrame->m_wndOutputTabView.AddMsg1(ref); HTREEITEM hItem = pCurrent->getItem(); int item = (int )hItem; strItem += _itot( item, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strItem); strFile += (const TCHAR *)pCurrent->getFile(); pMainFrame->m_wndOutputTabView.AddMsg1(strFile); strPath += (const TCHAR *)pCurrent->getPath(); pMainFrame->m_wndOutputTabView.AddMsg1(strPath); int type = pCurrent->getType(); strType = _itot( type, buffer, 10 ); pMainFrame->m_wndOutputTabView.AddMsg1(strType); pMainFrame->m_wndOutputTabView.AddMsg1(_T("************************")); } } }
bool CUIComboBox::AddSubItem(UINT uIndex, LPCTSTR pstrText) { CUIListLabelElement *pLabel = new CUIListLabelElement; if (pLabel == NULL) { return false; } TCHAR buffer[10]; UINT uId = GetId() * 10 + uIndex; _itot(uId, buffer, 10); pLabel->SetName(buffer); pLabel->SetText(pstrText); pLabel->SetId(uId); if (pLabel->GetText() == _T("")) { pLabel->SetEnabled(false); } return Add(pLabel); }
void TestPPTDOMStripperWorker::TestFactoryVersion() { MetawallBackEnd::IMWHostInstanceManagerPtr spHostController; assertMessage(S_OK == spHostController.CreateInstance(_T("PowerPointInstanceManager.Controller")), _T("Failed to create PowerPoint Instance Manager")); CStdString sValidFileName = CreateTestResultDocument(TEST_FILE_ALL_PPT_METADATA , _T(__FUNCTION__)); PowerPoint::_PresentationPtr spPresentation = spHostController->OpenDocument(sValidFileName.c_str(), false); PowerPoint::_ApplicationPtr spApplication(spPresentation->Application); CDOMFactory DOMFactory; DOMFactory.Factory(spPresentation); int domVersion = DOMFactory.m_pPPTWorker->Version(); TCHAR buf[3]; _itot( domVersion , buf, 10); CStdString sDOMVersion(buf); CStdString sApplicationVersion(spApplication->Version); int appVersion = _ttoi(sApplicationVersion.c_str()); sApplicationVersion = sApplicationVersion.substr( 0, sApplicationVersion.find(_T("."))); CStdString sErr; sErr.Format(_T("Incorrect Worker Version returned, expected [%s], actual [%s]"), sApplicationVersion.c_str(), buf); assertMessage(domVersion <= appVersion , sErr.c_str() ); }
/** * @brief Export options to file. * * This function enumerates through our options storage and saves * every option name and value to file. * * @param [in] filename Filename where optios are written. * @return * - OPT_OK when succeeds * - OPT_ERR when writing to the file fails */ int COptionsMgr::ExportOptions(LPCTSTR filename) { int retVal = OPT_OK; OptionsMap::iterator optIter = m_optionsMap.begin(); while (optIter != m_optionsMap.end() && retVal == OPT_OK) { const String name(optIter->first); String strVal; varprop::VariantValue value = optIter->second.Get(); if (value.GetType() == varprop::VT_BOOL) { if (value.GetBool()) strVal = _T("1"); else strVal = _T("0"); } else if (value.GetType() == varprop::VT_INT) { TCHAR num[10] = {0}; _itot(value.GetInt(), num, 10); strVal = num; } else if (value.GetType() == varprop::VT_STRING) { strVal = value.GetString(); } BOOL bRet = WritePrivateProfileString(_T("WinMerge"), name.c_str(), strVal.c_str(), filename); if (!bRet) retVal = OPT_ERR; optIter++; } return retVal; }
TCHAR* GetContactUID(MCONTACT hContact) { char *szProto = GetContactProto(hContact); char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if (INT_PTR(uid) == CALLSERVICE_NOTFOUND || uid == 0) return NULL; DBVARIANT vrUid; if (db_get_s(hContact, szProto, uid, &vrUid, 0)) return NULL; if (vrUid.type == DBVT_DWORD) { TCHAR tmp[100]; _itot(vrUid.dVal, tmp, 10); return mir_tstrdup(tmp); } if (vrUid.type == DBVT_ASCIIZ) { TCHAR *res = mir_a2t(vrUid.pszVal); mir_free(vrUid.pszVal); return res; } if (vrUid.type == DBVT_UTF8) { TCHAR *res = mir_utf8decodeT(vrUid.pszVal); mir_free(vrUid.pszVal); return res; } return NULL; }
TCHAR *itot(int num) { TCHAR tRes[32]; // check this _itot(num, tRes, 10); return mir_tstrdup(tRes); }
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wparam, LPARAM lparam) { HDC hdc; PAINTSTRUCT ps; TCHAR s[10], str[20] = _T("Секунды: "); static int counter = 0; if (Message == WM_CREATE) { SetTimer(hwnd, 1, 1000, NULL); } if (Message == WM_TIMER) { counter++; InvalidateRect(hwnd, NULL, TRUE); } if (Message == WM_PAINT) { hdc = BeginPaint(hwnd, &ps); _tcscat(str + 9, _itot(counter, s, 10)); TextOut(hdc, 0, 0, str, _tcslen(str)); EndPaint(hwnd, &ps); } if (Message == WM_DESTROY) { KillTimer(hwnd, 1); PostQuitMessage(0); return 0; } return DefWindowProc(hwnd, Message, wparam, lparam); }
void ui_speed_settings_dialog(HWND hwnd) { /* DialogBox(winmain_instance, (LPCTSTR)translate_res(IDD_CUSTOM_SPEED_DIALOG), hwnd, dialog_proc); */ uilib_dialogbox_param_t param; int speed; resources_get_int("Speed", &speed); param.hwnd = hwnd; param.idd_dialog = translate_res(IDD_CUSTOM_SPEED_DIALOG); param.idc_dialog = IDC_CUSTOM_SPEED; _itot(speed, param.string, 10); uilib_dialogbox(¶m); if (param.updated > 0) { speed = _ttoi(param.string); if (speed > 0 && speed < 1000000) resources_set_int("Speed", speed); } }
void CEffectsListDlg::initEffectsListDlg(HWND dlgHwnd) { hwnd = dlgHwnd; lHwnd = GetDlgItem(dlgHwnd,IDC_EFFECTSLIST); t1Hwnd = GetDlgItem(dlgHwnd, IDC_FXSTART); t2Hwnd = GetDlgItem(dlgHwnd, IDC_FXSTOP); trkHwnd = GetDlgItem(dlgHwnd, IDC_FXTRACK); swapHwnd = GetDlgItem(dlgHwnd, IDC_SWAPINPUTS); TCHAR data[256]; _i64tot(start, data, 10); SendMessage(t1Hwnd, WM_SETTEXT, 0, (LPARAM)data); _i64tot(stop, data, 10); SendMessage(t2Hwnd, WM_SETTEXT, 0, (LPARAM)data); _itot(track, data, 10); SendMessage(trkHwnd, WM_SETTEXT, 0, (LPARAM)data); if(type) { SendMessage(dlgHwnd, WM_SETTEXT, 0, (LPARAM)_T("Add Transition")); ShowWindow(swapHwnd, SW_SHOW); if(type > TYPE_TRANS) { EnableWindow(trkHwnd, FALSE); EnableWindow(swapHwnd, FALSE); if(swap)SendMessage(swapHwnd, BM_SETCHECK, BST_CHECKED, 0); } } ListEffects(); }
void CMainDlg::OnAdd() { int nCount = m_wndAccountListView.GetItemCount(); nCount++; TCHAR szRowIndex[20]={0}; _itot(nCount,szRowIndex,10); TCHAR szFilter[] = _T("Pdf Files (*.Pdf)\0*.Pdf\0All Files (*.*)\0*.*\0\0"); CFileDialog dlg(true,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,szFilter,this->m_hWnd); WCHAR strBuffer[65535] = {0}; dlg.m_ofn.lpstrFile = strBuffer; dlg.m_ofn.nMaxFile = 65535; TCHAR infilename[MAX_PATH]={0}; if(dlg.DoModal() == IDOK ) { CString strbuf; TCHAR* pFilePath =NULL; TCHAR szFileDirectory[MAX_PATH]={0}; pFilePath = dlg.m_ofn.lpstrFile; _tcscpy(szFileDirectory,pFilePath); TCHAR* szFileTitle = dlg.m_ofn.lpstrFileTitle; PathRemoveFileSpec(szFileDirectory); TCHAR* szExt = PathFindExtension(pFilePath); int nSize = GetContextFileSize(pFilePath); TCHAR szSize[MAX_PATH]={0}; _stprintf(szSize,_T("%dK"),nSize); int nItem = m_wndAccountListView.Append(szRowIndex,NULL,0,LISTITEM_CHECKBOX); m_wndAccountListView.AppendSubItem(nItem,szFileTitle); m_wndAccountListView.AppendSubItem(nItem,szFileDirectory); m_wndAccountListView.AppendSubItem(nItem,szExt); m_wndAccountListView.AppendSubItem(nItem,szSize); } }
CGPacket::CGPacket(LPBYTE lpData, DWORD dwLen, CProperty& Property) { if (lpData == NULL || dwLen == 0)return; m_pBuf = new BYTE[dwLen]; memcpy(m_pBuf, lpData, dwLen); m_dwSize = dwLen; m_property = Property; m_pRawBuf = lpData; m_bFiltered = FALSE; if (Property.s != INVALID_SOCKET) { sockaddr_in sin; int sinlen = sizeof(sin); if (0 == getpeername(Property.s, (sockaddr*)&sin, &sinlen)) { TCHAR tszTemp[256], tszIP[64]; DWORD dwLen = sizeof(tszTemp), dwPort; if (0 == WSAAddressToString((SOCKADDR *)&sin, sizeof(SOCKADDR), NULL, tszTemp, (LPDWORD)&dwLen)) { _stscanf_s(tszTemp, _T("%[0-9,.]:%d"), tszIP, sizeof(tszIP), &dwPort); m_property.strIpAddr = tszIP; m_property.dwPort = dwPort; TCHAR szBuf[32]; _itot(dwPort, szBuf, 10); m_property.strPort = Tstring(szBuf); } } } }
void COutputTabView::AddStatusListCtrl3() { LANGID dwLanguageID = GetSystemLanguagePrimaryID(); TCHAR buffer[16]; int iCount = m_listCtrl3.GetItemCount(); int iBufferSize = 16; CString strCount = _itot(iCount, buffer, 10); LPTSTR lpszCount = _T("0"); LVCOLUMN lvcol; switch(dwLanguageID) { case LANG_SPANISH: strCount = _T("Contenido *** ") + strCount + _T(" palabra(s) encontrada(s) de la búsqueda. ***"); lpszCount = strCount.GetBuffer(iBufferSize); lvcol.pszText = lpszCount; m_listCtrl3.SetColumn(7, &lvcol); break; default: strCount = _T("Content *** ")+ strCount + _T(" ocurrence(s) have been found. ***"); lpszCount = strCount.GetBuffer(iBufferSize); lvcol.pszText = lpszCount; m_listCtrl3.SetColumn(7, &lvcol); break; } }
void DataRecordsXmlSerializer::AppendXMLElement(IXmlWriter& xmlWriter, HistLogRecord& rec) { TCHAR bf[100]; xmlWriter.WriteElementString(NULL, _T("dateadded"), NULL, SystemTime2String(bf, rec.dateAdded)); _itot(rec.actID, bf, 10); xmlWriter.WriteElementString(NULL, _T("actiontype"), NULL, bf); }
void CPrintPref::OnLbnSelchangeHdglist() { // TODO: do this only once for (int i=0; i<sizeof(controlIDs)/sizeof(*controlIDs); ++i) GetDlgItem(controlIDs[i])->EnableWindow(); // get selected template int idx = m_hsListBox.GetCurSel(); const HeadingStyle& hs = m_Template.headings[idx]; // set controls accordingly SetRadioCheck(IDC_PFXNUM, hs.numbered); SetRadioCheck(IDC_BEGINONNEW, hs.breakPage); SetRadioCheck(IDC_JUSLEFT, hs.justify == HeadingStyle::JFY_LEFT); SetRadioCheck(IDC_JUSCENTER, hs.justify == HeadingStyle::JFY_CENTER); SetRadioCheck(IDC_JUSRIGHT, hs.justify == HeadingStyle::JFY_RIGHT); SetRadioCheck(IDC_PFMTBOLD, hs.fontBold); SetRadioCheck(IDC_PFMTITALIC, hs.fontItalic); SetRadioCheck(IDC_PFMTUNDERLINE, hs.fontUnderline); m_fontNames.SelectString(-1, hs.fontFamily); TCHAR fontSize[32]; _itot(hs.fontPointSize, fontSize, 10); if (m_fontSizes.SelectString(-1, fontSize) == CB_ERR) { m_fontSizes.SetCurSel(-1); m_fontSizes.SetWindowText(fontSize); } }
void COptionTreeWrapper::SerializeStaticItemInt(IArchive &ar, COptionTreeItem *item, bool read) { int iVal; COptionTreeItemStatic *otiStatic; TCHAR buffer[50]; CString text; otiStatic = dynamic_cast<COptionTreeItemStatic*>(item); if(otiStatic == NULL) { //error StdString error = _T("Could not cast item to COptionTreeItemStatic: "); error += item->GetLabelText(); ::MessageBox(NULL, error, _T("Invalid Command"), MB_OK); return; } if(read) { ar.Read(iVal); _itot(iVal, buffer, 10); otiStatic->SetStaticText(buffer); } else { text = otiStatic->GetStaticText(); iVal = _tstoi(text); ar.Write(iVal); } }
WORD MTime::DateFormatAlt(LPTSTR ptszTimeFormat, WORD cchTimeFormat) { if (!ptszTimeFormat || !cchTimeFormat) return 0; WORD wRes = DateFormat(ptszTimeFormat, cchTimeFormat); if (wRes != 0) return wRes; SYSTEMTIME AltSysTime = _SysTime; MTime mtNow; mtNow.GetLocalTime(); AltSysTime.wYear=mtNow.Year(); if ((cchTimeFormat = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &AltSysTime, NULL, ptszTimeFormat, cchTimeFormat)) == 0) { *ptszTimeFormat = 0; return 0; } TCHAR tszText[10]; _itot(mtNow.Year(), tszText, 10); TCHAR * tszYear = _tcsstr(ptszTimeFormat, tszText); if (tszYear && mir_tstrlen(tszYear) == 4) mir_tstrcpy(tszYear, _T("????")); else { *ptszTimeFormat = 0; return 0; } return cchTimeFormat; }
void CPagePlayers::SavePlayerListColumnOrderToRegistry() { // Open/create the registry key CRegKey key; key.Create(HKEY_LOCAL_MACHINE, HKLM_AllSrvUI); // Get the current column ordering int vecOrder[c_cColumns]; for (int iCol = 0; iCol < c_cColumns; ++iCol) vecOrder[iCol] = iCol; m_listPlayers.GetColumnOrderArray(vecOrder, c_cColumns); // Format a comma-delimited string of the column ordering CString strColumnOrder; for (int i = 0; i < c_cColumns; ++i) { if (i) strColumnOrder += ","; TCHAR szNum[16]; strColumnOrder += _itot(vecOrder[i], szNum, 10); } // Save to the registry // mdvalley: SetStringValue (swap) key.SetValue(strColumnOrder, TEXT("PlayerListColumnOrder")); }
void CPagePlayers::SaveSendChatMRUToRegistry() { // Open/create the registry key CRegKey key; if (ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE, HKLM_AllSrvUI)) return; // SendChatMRU CRegKey keyMRU; if (ERROR_SUCCESS != keyMRU.Create(key, TEXT("SendChatMRU"))) return; // Write the count of strings int cStrings = min(m_comboSendChat.GetCount(), c_cMaxChatsInRegistry); // mdvalley: SetDWORDValue (swap) keyMRU.SetValue(cStrings, TEXT(".Count")); // Write each string for (int i = 0; i < cStrings; ++i) { TCHAR szInt[16]; CString strMRUItem; m_comboSendChat.GetLBText(i, strMRUItem); // mdvalley: SetStringValue(swap) keyMRU.SetValue(strMRUItem, _itot(i, szInt, 10)); } }