2012-02-13 5 views
2
typedef struct{ 
    IMAGE *fuente; 
    IMAGE *destino; 
    int saltos; 
} ARGTHREAD; 

ARGTHREAD values; 

DWORD WINAPI ProcessThread(LPVOID arg){ 

    int i,j,imageRows,imageCols,C,R; 
    PIXEL *pfte,*pdst; 
    PIXEL *v0,*v1,*v2,*v3,*v4,*v5,*v6,*v7; 

    //memcpy(arg->destino, arg->fuente,sizeof(IMAGE)-sizeof(PIXEL *)); 

    imageRows = arg->fuente->infoheader.rows;//error here -> 
    imageCols = arg->fuente->infoheader.cols;//error here -> 

    //arg->destino->pixel=(PIXEL *)malloc(sizeof(PIXEL)*imageRows*imageCols); 

    i=arg->saltos;//error here -> 
    R=imageRows-1; 
    C=imageCols-1; 
    while(i<R){ 
       j=1;   
      while(j<C){ 
       pfte=arg->fuente->pixel+imageCols*i+j;//error here -> 
       v0=pfte-imageCols-1; 
       v1=pfte-imageCols; 
       v2=pfte-imageCols+1; 
       v3=pfte-1; 
       v4=pfte+1; 
       v5=pfte+imageCols-1; 
       v6=pfte+imageCols; 
       v7=pfte+imageCols+1; 

       pdst=arg->destino->pixel+imageCols*i+j;//error here -> 

      if(abs(blackandwhite(*pfte)-blackandwhite(*v0))>DIF || 
        abs(blackandwhite(*pfte)-blackandwhite(*v1))>DIF || 
        abs(blackandwhite(*pfte)-blackandwhite(*v2))>DIF || 
        abs(blackandwhite(*pfte)-blackandwhite(*v3))>DIF || 
        abs(blackandwhite(*pfte)-blackandwhite(*v4))>DIF || 
        abs(blackandwhite(*pfte)-blackandwhite(*v5))>DIF || 
        abs(blackandwhite(*pfte)-blackandwhite(*v6))>DIF || 
        abs(blackandwhite(*pfte)-blackandwhite(*v7))>DIF){ 

        pdst->red=0; 
        pdst->green=0; 
        pdst->blue=0; 
       } 

       else{ 
        pdst->red=255; 
        pdst->green=255; 
        pdst->blue=255; 
       } 
       j++;   
      } 
     i = i+numProc; 
    } 
} 

これは私が私のトレッド作成している方法です:- >クラス/構造体/共用/ジェネリック型エラーを指している必要があり

myThread =のCreateThread(NULL、0、 (LPTHREAD_START_ROUTINE)ProcessThreadを、&値、0、NULL);

このようなエラーが多く発生しているのはなぜですか?

エラー8エラーC2228:「.cols'の左側のクラス/構造体/共用体を持っている必要があります

+0

'arg'は、' * 'void型である - どのようにあなたが期待しています'arg-> fuente'は動く? – ildjarn

答えて

3

argあなたが最初に戻って適切な型にキャストすることなく、そこから何かを得ることができない、void*ポインタです:

ARGTHREAD* arg_values = static_cast<ARGTHREAD*>(arg); 
// use arg_values->... 
0

あなたのプログラムは、(メンバーと)タイプではありませんvoid*の要素を要求します。最初に渡したタイプ(ARGTHREAD)にキャストしてから、void*ARGTHREAD*として扱うことができます。

関連する問題