afficher contenu d'un tabeau dans une boite dialog
bonjour
svp je veux aficher le contenu d'un tableau de int ds une boite dialog
j'ai ce code qui me permet d'afficher juste la valeur initiale du mon tableau
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
BOOL CImage::CalcMarqueB(CImage & marque, char strmarq[],int _hauteur, int m_largeur, int Rs[] )
{
if(!m_hDib)
return FALSE; // DIB non valide
if(!marque.m_hDib)
return FALSE; // DIB non valide
LPBITMAPINFOHEADER BmSrcInfo=(LPBITMAPINFOHEADER)GlobalLock(m_hDib);
LPBITMAPINFO biSrc=(LPBITMAPINFO)BmSrcInfo;
LPBITMAPINFOHEADER BmDestInfo=(LPBITMAPINFOHEADER)GlobalLock(marque.m_hDib);
LPBITMAPINFO biDest=(LPBITMAPINFO)BmDestInfo;
// Détermination du nombre de couleurs
int nColors = BmSrcInfo->biClrUsed ? BmSrcInfo->biClrUsed : 0x1FF & (1 << BmSrcInfo->biBitCount);
// Détermination de la zone des bits de l'image source et largeur lignes en octets
BYTE* lpSrcBits = (BYTE*)BmSrcInfo + BmSrcInfo->biSize + nColors*sizeof(RGBQUAD);
int nScanWidth = WIDTHBYTES(BmSrcInfo->biWidth * BmSrcInfo->biBitCount);
// Détermination de la zone des bits de l'image destination
BYTE* lpDestBits = (BYTE*)BmDestInfo + BmDestInfo->biSize + nColors*sizeof(RGBQUAD);
// Traitement différent selon nombre de bits/pixel
for (int L=0;strmarq[L]; L++)
return L;
double resultat=0;
int Cmp=0,x=0,y=0;
for (int i=1;i<L+1;i++)
{
while(Cmp<i*m_hauteur*m_largeur)
{
while(x< BmSrcInfo->biWidth)
{
while( y<BmSrcInfo->biHeight)
{
if(lpDestBits[y*nScanWidth+x] == 255)
resultat += lpSrcBits[y*nScanWidth+x];
else
resultat -= lpSrcBits[y*nScanWidth+x];
Cmp++;
y++;
}
if (y==BmSrcInfo->biHeight) y=0;
x++;
}
}
if(abs( resultat )> 80/100*(m_hauteur*m_largeur))
Rs[i] = 1;
if(abs( resultat )< 80/100*(m_hauteur*m_largeur))
Rs[i] = 0;
}
GlobalUnlock(m_hDib);
GlobalUnlock(marque.m_hDib);
return TRUE;
} |
et j'appelle cette fonction ici:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
void CDTatoSpacBlocDlg::OnDetect()
{
// TODO: Add your control notification handler code here
CString str;
int nindex = m_mfiles.GetCurSel();
if((nindex != LB_ERR))
m_mfiles.GetText( nindex,str );
str = m_pParent->m_repApp+"Marques\\"+str;
m_Marque.LoadFile(str);
if((m_Marque.GetWidth() < m_Image.GetWidth())&&(m_Marque.GetHeight() < m_Image.GetHeight()))
{
//Rs est un tableau où il faut récuperer les valeurs calculées sur chaque bloc
// CString strmarq = "1110011";
// CString Rs="";
char strmarq[]="1110011";
int Rs[]= {0,0,0,0,0,0,0,0};
int m_hauteur=24; // la taille du marque en generale
int m_largeur=24;
m_Image.CalcMarqueB(m_Marque,strmarq,m_hauteur,m_largeur,Rs);
str.Format("Resultat de comptage : %d",Rs);
m_Rs = str;
UpdateData(FALSE);
}
else
AfxMessageBox("Dimensions non identiques ... ");
} |
le probléme c que toujours j'affiche juste 0000000
je sais pas comment je passe les valeurs du mon tabeau par adresse
int & Rs[] : me donne plus qu'un erreur:(