Ejemplo n.º 1
0
/*
串口选择框初始化
*/
void DlgOptions::InitComBoBox( CComboBox &cb, int i )
{
	CString strCom;
	strCom.Format( _T("COM%d"), i );
	int nIndex = cb.FindString( 0, strCom );
	cb.SetCurSel( nIndex );
}
Ejemplo n.º 2
0
long CCompileEditView::DeleteCurExp(WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/)
{
	HSTreeToCompileEdit* pppData = (HSTreeToCompileEdit*)lParam;
	if(pppData == NULL)
		return 0;

	CTreeGroup* pTreeGroup = (CTreeGroup*)pppData->m_pName;
	if(pTreeGroup != NULL)
	{
		CExpression* pExpress = pTreeGroup->GetData();
		if(pExpress != NULL)
		{
			CString strName;
			strName.Format("%s",pExpress->GetName());

			CValue* pValoare;
			if ( m_pExternExpression->Lookup(strName,pExpress->GetExpressType(),pValoare) )
			{
				if( !pExpress->GetPWD().IsEmpty() ) // 有密码
				{
					CInputPassPwD dlg(this,_T("请输入公式密码"),strName);
					dlg.m_pExp = pExpress;
					if( dlg.DoModal() == IDCANCEL )
					{
						return 2;
					}
				}
				if( wParam )
				{
					m_pExternExpression->RemoveKey(strName,pExpress->GetExpressType());
					delete pValoare;
				}
			}

			if(m_pwndDlgMainBar != NULL)
			{
				CComboBox* pCombox = (CComboBox*)m_pwndDlgMainBar->GetDlgItem(IDC_NAMECOMBO);
				if(pCombox != NULL)
				{
					int nIndex = pCombox->FindString( 0, strName );
					if(nIndex != -1)
					{
						pCombox->DeleteString( nIndex );
					}
				}
			}
		}
	}
	else
	{
	}

	if(m_hExpressInTreePos == (HTREEITEM)pppData->m_pData)
	{
		OnNewExpress();
	}

	return 0;
}
Ejemplo n.º 3
0
int CALLBACK CFontsPage::FillInFaces(const ENUMLOGFONTEX* lpelfe,const TEXTMETRIC* lpntme,const int FontType,const LPARAM lParam)
{
//	if(FontType!=TRUETYPE_FONTTYPE)
//		return 1;
CComboBox* cb = (CComboBox*)lParam;
	ASSERT(cb);
	if(cb->FindString(0,lpelfe->elfLogFont.lfFaceName)>=0)
		return 1;
	cb->AddString(lpelfe->elfLogFont.lfFaceName);
	return 1;
}
Ejemplo n.º 4
0
int CALLBACK CFontsPage::FillInCharsets(const ENUMLOGFONTEX* lpelfe,const TEXTMETRIC* lpntme,const int FontType,const LPARAM lParam)
{
//	if(FontType!=TRUETYPE_FONTTYPE)
//		return 1;
CComboBox* cb = (CComboBox*)lParam;
	ASSERT(cb);
	if(cb->FindString(0,(char*)lpelfe->elfScript)>=0)
		return 1;
int i = cb->AddString((char*)lpelfe->elfScript);
	ASSERT(i>=0);
	VERIFY(cb->SetItemData(i,lpelfe->elfLogFont.lfCharSet)!=LB_ERR);
	return 1;
}
Ejemplo n.º 5
0
LRESULT CDlg_H323::OnRecvConnect(WPARAM wParam,LPARAM lParam)
{
	//record the successful connect ip address
	CComboBox *pCombo = (CComboBox*)GetDlgItem(IDC_H323_CALLED_ADDR);
	if(pCombo && pCombo->FindString(-1,LPCTSTR(m_strCalled)) == CB_ERR)
	{
		pCombo->AddString(m_strCalled);
		SaveIpAddr();
	}

	CloseCallingDlg();
	KillTimer(2006);
	CWnd *pBtn = GetDlgItem(IDC_H323_HANGUP);
	if(pBtn)
		pBtn->EnableWindow(TRUE);

	if(!m_bName)
		AddParty(myContext->localIP);
	else
		AddParty(LPCTSTR(m_strName));

	AddParty(m_strCalled);
    return 0;
}
BOOL COptionPageLanguage::OnInitDialog()
{
	CMFCPropertyPage::OnInitDialog();

	//Set URLs
	CString DictURL;
	DictURL.LoadString(ID_URL_TCDICTDOWNLOAD);
	int idLastLineBreak = DictURL.ReverseFind(_T('\n'));
	ASSERT(idLastLineBreak > 0);
	m_wndURLDownloadDicts.SetURL(DictURL.Mid(idLastLineBreak + 1));
	m_wndURLDownloadDicts.SizeToContent(true,true);

	FindDictionaries();
	CComboBox *pLangBox = (CComboBox*)GetDlgItem(IDC_OPTIONS_LANGUAGE);

	// Add all the found languages
	for (int i = 0; i < m_aLanguage.GetSize(); ++i)
	{
		if (pLangBox->FindString(0,m_aLanguage[i]) == CB_ERR)
			pLangBox->AddString(m_aLanguage[i]);
	}

	// Select the language
	int nSel = pLangBox->FindStringExact(0,m_strLanguageDefault);

	if (nSel == CB_ERR)
		pLangBox->SetCurSel(0);
	else
		pLangBox->SetCurSel(nSel);

	OnSelchangeOptionsLanguage();
	UpdateControlStates();

	return TRUE; // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 7
0
void CCompileEditView::SaveDataMenu(UINT nID)
{
	if(g_pSaveMenu.m_hMenu == NULL)
		return;

	CString strComm;
	g_pSaveMenu.GetMenuString(nID,strComm,MF_BYCOMMAND);
	if(strComm.IsEmpty())
		return;

	int nPos = strComm.Find(":");
	if( nPos != -1 )
	{
		strComm = strComm.Mid(nPos+1);
	}
	if(strComm.IsEmpty())
		return;

	if(!IsCompileEdit(COMPILE))
		return;

	CTreeCtrlFormula* pHxTreeCtrl = NULL;

	HTREEITEM hFloatTreeItem = NULL;
	CTreeCtrlFormula* pFloatTree = NULL;
	CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
	if(pMain != NULL)
	{
		if(pMain->GetIndividualInfo() != NULL)
		{
			pFloatTree = pMain->GetIndividualInfo();
		}
	}

	HTREEITEM hTreeItem = NULL;
	char	  cType = 0;
	
	nID -= SAVEMENU_BEGIN;
	if(nID >= 0 && nID < 100)
	{
		cType = Tech;
		if(pHxTreeCtrl != NULL)
		{				
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strTech);//		 = "技术指标";
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strTech);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}
	if( nID >= 100 && nID < 200 )
	{
		cType = Condition;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strCondition);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strCondition);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}
	if( nID >= 200 && nID < 300 )
	{
		cType = Exchange;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strExchange);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strExchange);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}
	if( nID >= 300 && nID < 400 )
	{
		cType = MoreKLine;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strColorKLine);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strColorKLine);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}		
	if( nID >= 400 && nID < 500 )
	{
		cType = ExpressBin;
		if(pHxTreeCtrl != NULL)
		{
			hTreeItem = pHxTreeCtrl->GetRootTree(CTreeCtrlFormula::g_strRecycleBin);//		 = "技术指标";				
			hTreeItem = pHxTreeCtrl->GetTreeItem(strComm,hTreeItem);
		}
		if(pFloatTree != NULL)
		{
			hFloatTreeItem = pFloatTree->GetRootTree(CTreeCtrlFormula::g_strRecycleBin);//		 = "技术指标";
			hFloatTreeItem = pFloatTree->GetTreeItem(strComm,hFloatTreeItem);
		}
	}

	CString strName;
	CComboBox* pBox = NULL;
	if(m_pwndDlgMainBar != NULL)
	{
		pBox = (CComboBox*)m_pwndDlgMainBar->GetDlgItem(IDC_NAMECOMBO);
		if(pBox != NULL)
		{			
			pBox->GetWindowText(strName);
			strName.MakeUpper();
			if( pBox->FindString(0,strName) != CB_ERR )
			{
				CValue* valoare;
				if ( m_pExternExpression->Lookup(strName,valoare) ) // 外部表达式表
				{
				}
			}
			else
			{
				pBox->AddString(strName);
			}
		}
	}
	

	if( pHxTreeCtrl != NULL && hTreeItem != NULL && !strName.IsEmpty())
	{
		m_hExpressInTreePos = pHxTreeCtrl->AddItem(strName,cType,hTreeItem/*pHxTreeCtrl->GetCurSavePos(hTreeItem)*/,m_pExternExpression);
	}

	// 浮动窗口	
	if( pFloatTree != NULL && hFloatTreeItem != NULL && !strName.IsEmpty())
	{
		pFloatTree->AddItem(strName,cType,hFloatTreeItem/*pFloatTree->GetCurSavePos(hFloatTreeItem)*/,m_pExternExpression);
	}

	::SendMessage( g_hParentWnd,HX_USER_UPDATEDATA,0,(LPARAM)&strName );
}
Ejemplo n.º 8
0
void CStockPropPage::FillPropnameList(REFGUID guid, int nIndirect, CComboBox& combo)
{
	USES_CONVERSION;

	combo.ResetContent();
	UINT cProps = 0;

	ULONG nObjects;
	LPDISPATCH* ppDisp = GetObjectArray(&nObjects);

	if (ppDisp != NULL)
	{
		LPTYPEINFO pTypeInfo;
		LPTYPEATTR pTypeAttr;
		LPVARDESC pVarDesc;
		ULONG iObj;
		WORD iProp;
		BSTR rgbstr[1];
		UINT cName;

		// Get the property sheet locale
		LPPROPERTYPAGESITE pPageSite;
		if ((pPageSite = GetPageSite()) != NULL)
			if (FAILED(pPageSite->GetLocaleID(&m_lcid)))
				m_lcid = 0;

		// Iterate through all objects.

		for (iObj = 0; iObj < nObjects; iObj++)
		{
			pTypeInfo = NULL;
			if ((ppDisp[iObj] != NULL) &&
				SUCCEEDED(ppDisp[iObj]->GetTypeInfo(0, m_lcid, &pTypeInfo)))
			{
				ASSERT(pTypeInfo != NULL);
				pTypeAttr = NULL;
				if (SUCCEEDED(pTypeInfo->GetTypeAttr(&pTypeAttr)))
				{
					ASSERT(pTypeAttr != NULL);

					// Iterate through all properties of object.

					for (iProp = 0; iProp < pTypeAttr->cVars; iProp++)
					{
						pVarDesc = NULL;
						if (SUCCEEDED(pTypeInfo->GetVarDesc(iProp, &pVarDesc)))
						{
							// Check whether property has desired type

							if (!(pVarDesc->wVarFlags & VARFLAG_FHIDDEN) &&
								AfxOleTypeMatchGuid(pTypeInfo,
									&pVarDesc->elemdescVar.tdesc, guid,
									nIndirect))
							{
								// Get property name and insert into list.

								if (SUCCEEDED(pTypeInfo->GetNames(
										pVarDesc->memid, rgbstr, 1, &cName)))
								{
									// Don't insert duplicates.

									LPCTSTR lpstr = OLE2CT(rgbstr[0]);
									if (combo.FindString(-1, lpstr)
											== CB_ERR)
									{
										int iItem = combo.AddString(lpstr);
										if (iItem >= 0)
										{
											combo.SetItemData(iItem, (DWORD)pVarDesc->memid);
											++cProps;
										}
									}

									SysFreeString(rgbstr[0]);
								}
							}
							pTypeInfo->ReleaseVarDesc(pVarDesc);
						}
					}

					pTypeInfo->ReleaseTypeAttr(pTypeAttr);
				}
				pTypeInfo->Release();
			}
		}
	}

	// Select the first one
	m_iPropName = 0;            // Prevents save from happening
	if (combo.SetCurSel(0) != CB_ERR)
		combo.GetLBText(0, m_strPropName);

	// Disable or set the size of the combo, as appropriate
	if (cProps <= 1)
		combo.EnableWindow(FALSE);
	else
		_AfxSizeComboToContent(&combo);

	UpdateData(FALSE);
	SetModifiedFlag(FALSE);
}