I have created a dialog app, which return a debug error meesage that i don't understand. This message is:
Debug error
Program:\CalcRiskPort\Debug\CalcRiskPort.exe
DAMAGE: after Normal block (#81) at 0x00301190
when i pree retry i have this message box:
User breakpoint called from code at 0x1021376f
you could see the following code concerned
void CCalcRiskPortDlg::OnCalcvar()
{
UpdateData(TRUE);
::CoInitialize(NULL);
//LoadTables Table;
//LoadTables Table2(m_dlgSector);
double *pTabVar=new double[(double)pow(2,m_dlgAsset)];
double *pTabMoy=new double[(double)pow(2,m_dlgAsset)];
CString *pTabPortStr=new CString[(long)pow(2,m_dlgAsset)];
CString strValue,strPortOpti,strMaxiSharpe,strMaxiEfficience;
double MiniVar,MaxiSharpe,MaxiEfficience;
int Rang;
double *pMiniVar=new double[2];
//double *pMiniRatio=new double[2];
double *pMaxiRatioSharpe=new double[2];
double *pMaxiRatioEfficience=new double[2];
int *pTabBinPort=new int[m_dlgAsset];
int *pTabNumPort=new int[m_dlgAsset];
int k,i;
try
{
LoadTables Table(1,m_dlgSector,1,m_dlgSector);
_ConnectionPtr pConnection=NULL;
CString strTemp;
strTemp.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\CalcRiskPort\\Vol&CorrelDB.mdb;"
_bstr_t strCnn(strTemp);
TESTHR(pConnection.CreateInstance(__uuidof(Connection)));
pConnection->Open(strCnn,"","",adConnectUnspecified);
Table.pCorrel=Table.LoadCorrelation(m_dlgSector,Table.pCorrel,"Correlation"
Table.pVol=Table.LoadVolatility(m_dlgSector,Table.pVol,"Volatilité"
Table.pYield=Table.LoadYield(m_dlgSector,Table.pYield,"Ratio"
i=0;
for(k=0;k<=m_dlgAsset-1;k++)
{
*(pTabBinPort+k)=0;
Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort);
}
*pTabVar=Table.CalcVar(pTabNumPort,m_dlgAsset);
*pTabMoy=Table.CalcMoy(pTabNumPort,m_dlgAsset);
Table.pRatioSharpe[0]=(*pTabMoy)/(*pTabVar);
Table.pRatioEfficience[0]=((*pTabMoy+i)-m_dlgRate0)/(*pTabVar);
*pTabPortStr=Table.AgregIntToStr(pTabNumPort,m_dlgAsset);
for(i=1;i<=pow(2,m_dlgAsset)-1;i++)
{
k=m_dlgAsset-1;
while(*(pTabBinPort+k)==1)
{
*(pTabBinPort+k)=0;
Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort);
if(k!=0)
k--;
}
*(pTabBinPort+k)=1;
Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort);
*(pTabVar+i)=Table.CalcVar(pTabNumPort,m_dlgAsset);
*(pTabMoy+i)=Table.CalcMoy(pTabNumPort,m_dlgAsset);
Table.pRatioEfficience=(*(pTabMoy+i))/(*(pTabVar+i));
Table.pRatioSharpe=((*(pTabMoy+i))-m_dlgRate0)/(*(pTabVar+i));
*(pTabPortStr+i)=Table.AgregIntToStr(pTabNumPort,m_dlgAsset);
}
pMiniVar=Table.CalcMin(pTabVar,pMiniVar,(long)pow(2,m_dlgAsset));
pMaxiRatioSharpe=Table.CalcMax(Table.pRatioSharpe,pMaxiRatioSharpe,m_dlgAsset);
pMaxiRatioEfficience=Table.CalcMax(Table.pRatioEfficience,pMaxiRatioEfficience,m_dlgAsset);
MiniVar=pMiniVar[0];
MaxiSharpe=pMaxiRatioSharpe[0];
MaxiEfficience=pMaxiRatioEfficience[0];
Rang=(int)pMiniVar[1];
m_dlgValue=pTabVar[Rang];
m_dlgValue *=100;
m_dlgPortOpti=*(pTabPortStr+Rang);
strPortOpti=m_dlgPortOpti;
m_dlgSharpe=MaxiSharpe;
m_dlgEfficience=MaxiEfficience;
strMaxiSharpe.Format("%.5f",m_dlgSharpe);
strMaxiEfficience.Format("%.5f",m_dlgEfficience);
strValue.Format("%.5f",m_dlgValue);
CEdit* PEdit=(CEdit*)GetDlgItem(IDC_VALUE);
PEdit->SetWindowText(strValue);
CEdit* SEdit=(CEdit*)GetDlgItem(IDC_OPTI_PORT);
SEdit->SetWindowText(strPortOpti);
CEdit* ShEdit=(CEdit*)GetDlgItem(IDC_OPTI_SHARPE);
ShEdit->SetWindowText(strMaxiSharpe);
CEdit* EffEdit=(CEdit*)GetDlgItem(IDC_OPTI_EFFICIENCE);
EffEdit->SetWindowText(strMaxiEfficience);
delete []pMiniVar;
delete []pMaxiRatioSharpe;
delete []pMaxiRatioEfficience;
delete []pTabBinPort;
delete []pTabNumPort;
delete []pTabVar;
delete []pTabMoy;
pConnection->Close();
}
catch(_com_error &e)
{
AfxMessageBox("a pas bon"
}
::CoUninitialize();
// TODO: Add your control notification handler code here
}
so i hope that someone could help me to solve my problem
thanks in advance for your answers
jayjay
Debug error
Program:\CalcRiskPort\Debug\CalcRiskPort.exe
DAMAGE: after Normal block (#81) at 0x00301190
when i pree retry i have this message box:
User breakpoint called from code at 0x1021376f
you could see the following code concerned
void CCalcRiskPortDlg::OnCalcvar()
{
UpdateData(TRUE);
::CoInitialize(NULL);
//LoadTables Table;
//LoadTables Table2(m_dlgSector);
double *pTabVar=new double[(double)pow(2,m_dlgAsset)];
double *pTabMoy=new double[(double)pow(2,m_dlgAsset)];
CString *pTabPortStr=new CString[(long)pow(2,m_dlgAsset)];
CString strValue,strPortOpti,strMaxiSharpe,strMaxiEfficience;
double MiniVar,MaxiSharpe,MaxiEfficience;
int Rang;
double *pMiniVar=new double[2];
//double *pMiniRatio=new double[2];
double *pMaxiRatioSharpe=new double[2];
double *pMaxiRatioEfficience=new double[2];
int *pTabBinPort=new int[m_dlgAsset];
int *pTabNumPort=new int[m_dlgAsset];
int k,i;
try
{
LoadTables Table(1,m_dlgSector,1,m_dlgSector);
_ConnectionPtr pConnection=NULL;
CString strTemp;
strTemp.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\CalcRiskPort\\Vol&CorrelDB.mdb;"
_bstr_t strCnn(strTemp);
TESTHR(pConnection.CreateInstance(__uuidof(Connection)));
pConnection->Open(strCnn,"","",adConnectUnspecified);
Table.pCorrel=Table.LoadCorrelation(m_dlgSector,Table.pCorrel,"Correlation"
Table.pVol=Table.LoadVolatility(m_dlgSector,Table.pVol,"Volatilité"
Table.pYield=Table.LoadYield(m_dlgSector,Table.pYield,"Ratio"
i=0;
for(k=0;k<=m_dlgAsset-1;k++)
{
*(pTabBinPort+k)=0;
Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort);
}
*pTabVar=Table.CalcVar(pTabNumPort,m_dlgAsset);
*pTabMoy=Table.CalcMoy(pTabNumPort,m_dlgAsset);
Table.pRatioSharpe[0]=(*pTabMoy)/(*pTabVar);
Table.pRatioEfficience[0]=((*pTabMoy+i)-m_dlgRate0)/(*pTabVar);
*pTabPortStr=Table.AgregIntToStr(pTabNumPort,m_dlgAsset);
for(i=1;i<=pow(2,m_dlgAsset)-1;i++)
{
k=m_dlgAsset-1;
while(*(pTabBinPort+k)==1)
{
*(pTabBinPort+k)=0;
Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort);
if(k!=0)
k--;
}
*(pTabBinPort+k)=1;
Table.ConvertBinToNum(k,pTabBinPort,pTabNumPort);
*(pTabVar+i)=Table.CalcVar(pTabNumPort,m_dlgAsset);
*(pTabMoy+i)=Table.CalcMoy(pTabNumPort,m_dlgAsset);
Table.pRatioEfficience=(*(pTabMoy+i))/(*(pTabVar+i));
Table.pRatioSharpe=((*(pTabMoy+i))-m_dlgRate0)/(*(pTabVar+i));
*(pTabPortStr+i)=Table.AgregIntToStr(pTabNumPort,m_dlgAsset);
}
pMiniVar=Table.CalcMin(pTabVar,pMiniVar,(long)pow(2,m_dlgAsset));
pMaxiRatioSharpe=Table.CalcMax(Table.pRatioSharpe,pMaxiRatioSharpe,m_dlgAsset);
pMaxiRatioEfficience=Table.CalcMax(Table.pRatioEfficience,pMaxiRatioEfficience,m_dlgAsset);
MiniVar=pMiniVar[0];
MaxiSharpe=pMaxiRatioSharpe[0];
MaxiEfficience=pMaxiRatioEfficience[0];
Rang=(int)pMiniVar[1];
m_dlgValue=pTabVar[Rang];
m_dlgValue *=100;
m_dlgPortOpti=*(pTabPortStr+Rang);
strPortOpti=m_dlgPortOpti;
m_dlgSharpe=MaxiSharpe;
m_dlgEfficience=MaxiEfficience;
strMaxiSharpe.Format("%.5f",m_dlgSharpe);
strMaxiEfficience.Format("%.5f",m_dlgEfficience);
strValue.Format("%.5f",m_dlgValue);
CEdit* PEdit=(CEdit*)GetDlgItem(IDC_VALUE);
PEdit->SetWindowText(strValue);
CEdit* SEdit=(CEdit*)GetDlgItem(IDC_OPTI_PORT);
SEdit->SetWindowText(strPortOpti);
CEdit* ShEdit=(CEdit*)GetDlgItem(IDC_OPTI_SHARPE);
ShEdit->SetWindowText(strMaxiSharpe);
CEdit* EffEdit=(CEdit*)GetDlgItem(IDC_OPTI_EFFICIENCE);
EffEdit->SetWindowText(strMaxiEfficience);
delete []pMiniVar;
delete []pMaxiRatioSharpe;
delete []pMaxiRatioEfficience;
delete []pTabBinPort;
delete []pTabNumPort;
delete []pTabVar;
delete []pTabMoy;
pConnection->Close();
}
catch(_com_error &e)
{
AfxMessageBox("a pas bon"
}
::CoUninitialize();
// TODO: Add your control notification handler code here
}
so i hope that someone could help me to solve my problem
thanks in advance for your answers
jayjay