void DlgBfLog::UpdateLog() { CXTraderApp* pApp = (CXTraderApp*)AfxGetApp(); UINT uSize = pApp->m_cT->m_BfTransVec.size(); UINT iSubItem = 0; CString szItems[6]; for (UINT i=0;i<uSize;i++) { szItems[0].Format(_T("%d"),pApp->m_cT->m_BfTransVec[i]->FutureSerial); ansi2uni(CP_ACP,pApp->m_cT->m_BfTransVec[i]->BankAccount,szItems[1].GetBuffer(MAX_PATH)); szItems[1].ReleaseBuffer(); szItems[2]=JgBfTdType(pApp->m_cT->m_BfTransVec[i]->TradeCode); szItems[3].Format(_T("%.2f"),pApp->m_cT->m_BfTransVec[i]->TradeAmount); szItems[4] = TransTime(pApp->m_cT->m_BfTransVec[i]->TradeTime); ansi2uni(CP_ACP,pApp->m_cT->m_BfTransVec[i]->ErrorMsg,szItems[5].GetBuffer(3*MAX_PATH)); szItems[5].ReleaseBuffer(); //m_LstLog.SetRedraw(FALSE); for (iSubItem=0;iSubItem<6;iSubItem++) { if (iSubItem==0) { m_LstLog.InsertItem(i,NULL);} m_LstLog.SetItemText(i,iSubItem,szItems[iSubItem]); } //m_LstLog.SetRedraw(TRUE); } }
void DlgRecent::GetSvrGNByIdx(CString &szOut, int iBkrG, int iSvrG) { xml_document doc; xml_parse_result result; szOut.Empty(); result = doc.load_file(gv_Bkr[iBkrG].XmlPath); if (result.status == status_ok) { ///////////读出服务器////////////////// xpath_node_set sVrs = doc.select_nodes(_NDPATHSVR); if (sVrs.empty()) return; int iCount = 0; char strName[64]; for (xpath_node_set::const_iterator it = sVrs.begin(); it != sVrs.end(); ++it) { xpath_node nd = *it; iCount++; //读出服务器组名称 if (iCount == (iSvrG + 1)) { strcpy(strName, nd.node().child_value(_NDNAME)); ansi2uni(CP_ACP, strName, szOut.GetBuffer(MAX_PATH)); szOut.ReleaseBuffer(); break; } } } }
void CtpTraderSpi::OnRspOrderInsert(CThostFtdcInputOrderField *pInputOrder, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) { CXTraderDlg* pDlg = (CXTraderDlg*)g_pCWnd; if( IsErrorRspInfo(pRspInfo) || (pInputOrder==NULL) ) { TCHAR szErr[MAX_PATH]; ansi2uni(CP_ACP,pRspInfo->ErrorMsg,szErr); CThostFtdcOrderField* ErrOrd = new CThostFtdcOrderField(); ZeroMemory(ErrOrd, sizeof(CThostFtdcOrderField)); getCurTime(ErrOrd->InsertTime); strcpy(ErrOrd->InstrumentID,pInputOrder->InstrumentID); ErrOrd->Direction = pInputOrder->Direction; strcpy(ErrOrd->CombOffsetFlag,pInputOrder->CombOffsetFlag); ErrOrd->OrderStatus = THOST_FTDC_OST_ErrOrd; ErrOrd->LimitPrice = pInputOrder->LimitPrice; ErrOrd->VolumeTotalOriginal = pInputOrder->VolumeTotalOriginal; ErrOrd->VolumeTotal = pInputOrder->VolumeTotalOriginal; ErrOrd->VolumeTraded = 0; m_orderVec.push_back(ErrOrd); pDlg->InsertLstOrder(ErrOrd,INSERT_OP,szErr); } if(bIsLast) SetEvent(g_hEvent); }
void CtpTraderSpi::ShowCbErrs(TThostFtdcErrorMsgType ErrorMsg) { TCHAR szMsg[MAX_PATH]; ansi2uni(CP_ACP,ErrorMsg,szMsg); ShowErroTips(szMsg,MY_TIPS); }
void DlgRecent::InitLBox() { LoginDlg* pLogin = (LoginDlg*)GetParent(); m_List.SubclassDlgItem(IDC_LBRECENT, this); int i = 0; CAppCfgs& s = g_s; vector<LOGINPARA>& pAcc = s.m_pInfVec; vector<BKRPARA>& pBkr = s.m_BkrParaVec; int iSize = static_cast<int>(pAcc.size()); CString szAccInf,szUid,szPass; int iBkrGroup, iSvrGroup; CString szSvrGN; int iH=0; if (gv_Bkr.size()) { for (i = 0; i < iSize; i++) { ansi2uni(CP_UTF8, pAcc[i].szUid, szUid.GetBuffer(MAX_PATH)); szUid.ReleaseBuffer(); ansi2uni(CP_UTF8, pAcc[i].szPass, szPass.GetBuffer(MAX_PATH)); szPass.ReleaseBuffer(); iBkrGroup = pAcc[i].iBkrGroup; iSvrGroup = pAcc[i].iSvrGroup; GetSvrGNByIdx(szSvrGN, iBkrGroup, iSvrGroup); szAccInf.Format(_T("%s,%s,账户:%s,密码:%s"), pBkr[iBkrGroup].BkrName, (LPCTSTR)szSvrGN, (LPCTSTR)szUid, (LPCTSTR)szPass); m_List.AddString(szAccInf); iH = m_List.GetItemHeight(i)+1; m_List.SetItemHeight(i, iH); SetHScroll(); } } }
void DlgRecent::OnLbnSelchange() { LoginDlg* pLogin = (LoginDlg*)GetParent(); CString szUid,szPass; TThostFtdcPasswordType szDecPass; int iSel = m_List.GetCurSel(); if (iSel>=0) { vector<LOGINPARA>& pAcc = g_s.m_pInfVec; int iBkrGroup = pAcc[iSel].iBkrGroup; int iSvrGroup = pAcc[iSel].iSvrGroup; ansi2uni(CP_UTF8, pAcc[iSel].szUid, szUid.GetBuffer(MAX_PATH)); szUid.ReleaseBuffer(); Base64Decode(szDecPass, (const char*)pAcc[iSel].szPass, 0); ansi2uni(CP_UTF8, szDecPass, szPass.GetBuffer(MAX_PATH)); szPass.ReleaseBuffer(); pLogin->m_ComboBkr.ResetContent(); int iIdx = pLogin->m_ComboBkr.AddString(gv_Bkr[iBkrGroup].BkrName); pLogin->m_ComboBkr.SetItemData(iIdx, iBkrGroup); pLogin->m_ComboBkr.SetCurSel(0); pLogin->SendMessage(WM_COMMAND,MAKEWPARAM(IDC_BKR_LIST,CBN_SELCHANGE),(LPARAM)(pLogin->m_ComboBkr.GetSafeHwnd())); pLogin->m_ComboIsp.SetCurSel(iSvrGroup); pLogin->SendMessage(WM_COMMAND,MAKEWPARAM(IDC_ISPLIST,CBN_SELCHANGE),(LPARAM)(pLogin->m_ComboIsp.GetSafeHwnd())); HWND hEdUser = ::GetDlgItem(pLogin->m_hWnd,IDC_USERNAME); ::SendMessage(hEdUser,WM_SETTEXT, 0, (LPARAM)(LPCTSTR)szUid); HWND hEdPass = ::GetDlgItem(pLogin->m_hWnd,IDC_PASSWORD); ::SendMessage(hEdPass,WM_SETTEXT, 0, (LPARAM)(LPCTSTR)szPass); } }
void CtpTraderSpi::OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField *pInstrumentStatus) { if(pInstrumentStatus && g_pCWnd) { CXTraderDlg* pDlg = (CXTraderDlg*)g_pCWnd; CString szStat,szMsg,szExh; TCHAR szTm[30]; ansi2uni(CP_ACP,pInstrumentStatus->EnterTime,szTm); JgTdStatus(szStat,pInstrumentStatus->InstrumentStatus); szExh = JgExchage(pInstrumentStatus->ExchangeID); szMsg.Format(_T("%s %s:%s"),szTm,(LPCTSTR)szExh,(LPCTSTR)szStat); pDlg->SetStatusTxt(szMsg,2); } }
BOOL BfTransfer::OnInitDialog() { CXTraderApp* pApp = (CXTraderApp*)AfxGetApp(); TCHAR szUser[MAX_PATH/2],szTitle[MAX_PATH]; ansi2uni(CP_ACP,pApp->m_sINVESTOR_ID,szUser); _stprintf(szTitle,BFTRANS_TITLE,szUser); SetWindowText(szTitle); CString str; str.Format(_T("%.2f"),m_dTrsAmt); ((CEdit*)GetDlgItem(IDC_TRANSAMT))->SetWindowText(str); ((CEdit*)GetDlgItem(IDC_BKPASSWD))->SetWindowText(_T("1")); InitCombo(); return TRUE; }
LRESULT DlgQryHiSet::QrySmiMsg(WPARAM wParam,LPARAM lParam) { CXTraderApp* pApp = (CXTraderApp*)AfxGetApp(); UINT uBufSize = pApp->m_cT->m_StmiVec.size()*sizeof(TThostFtdcContentType); char* szMsg = new char[uBufSize]; ZeroMemory(szMsg,sizeof(szMsg)); for (UINT i=0;i<pApp->m_cT->m_StmiVec.size();i++) { strcat(szMsg,(const char*)pApp->m_cT->m_StmiVec[i]->Content); } ansi2uni(CP_ACP,szMsg,m_szHiSet.GetBuffer(4*uBufSize)); m_szHiSet.ReleaseBuffer(); UpdateData(FALSE); DELX(szMsg); return 0; }
void BfTransfer::InitCombo() { CXTraderDlg* pDlg = (CXTraderDlg*)g_pCWnd; CXTraderApp* pApp = (CXTraderApp*)AfxGetApp(); m_cbBkLst.SubclassDlgItem(IDC_CBBKLST,this); m_cbExhType.SubclassDlgItem(IDC_CBEXHTYPE,this); TCHAR strBkAcc[MAX_PATH]; CString szBkInfo,szBkName; int nIndex = 0; UINT i=0; UINT uSize = pApp->m_cT->m_AccRegVec.size(); for (i=0;i<uSize;i++) { ansi2uni(CP_ACP,pApp->m_cT->m_AccRegVec[i]->BankAccount,strBkAcc); szBkName = JgBkName(pApp->m_cT->m_AccRegVec[i]->BankID[0]); szBkInfo.Format(_T("%s[%s]"),(LPCTSTR)szBkName,strBkAcc); nIndex = m_cbBkLst.AddString(szBkInfo); m_cbBkLst.SetItemData(nIndex,i); } if (uSize>=1) { m_cbBkLst.SetCurSel(0); } LPCTSTR strExhType[3] = {_T("RMB"),_T("USD"),_T("HKD")}; for (i=0;i<3;i++) { nIndex = m_cbExhType.AddString(strExhType[i]); m_cbExhType.SetItemData(nIndex,i); } m_cbExhType.SetCurSel(0); }
HRESULT BstrStream::Write(LPCSTR pstr) { wstring wstr = ansi2uni(pstr); return Write(wstr.c_str()); }