全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:769
推到 Plurk!
推到 Facebook!

資料夾比對的問題

尚未結案
frankh
一般會員


發表:25
回覆:36
積分:12
註冊:2005-05-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-09-02 12:21:03 IP:218.165.xxx.xxx 未訂閱
請各位大大指導我一下我的程式碼哪裡有問題? 參考前輩之前的文章http://delphi.ktop.com.tw/topic.php?topic_id=71977 我把按鈕建改成直接用資料夾比對... 但是run不出來..且有個地方不懂..就是我是不是直接把按鈕建的地方去掉就可以..還是連同比對那邊的程式碼也要改? 以下是我的程式碼麻煩各位指導一下
void __fastcall TForm1::Button5Click(TObject *Sender)
{
  //Graphics::TBitmap *Bmp[0] = new Graphics::TBitmap();
  //Graphics::TBitmap *Bmp[1] = new Graphics::TBitmap();
  //Graphics::TBitmap *Bmp[2] = new Graphics::TBitmap();
  //Graphics::TBitmap *Bmp[3] = new Graphics::TBitmap();
  TSearchRec sr;
  String path = c:/test;
  String mask = "*.bmp";
  int iAttributes = 0;
  iAttributes |= faArchive;
    if (FindFirst(path   mask, iAttributes, sr) == 0)
  {
    do
    {
      if ((sr.Attr & iAttributes) == sr.Attr)
      {
          Image1->Picture->LoadFormFile(path sr.Name);
          Graphics::TBitmap *Bmp[4];      for(int i = 0; i < 4; i  )
        Bmp[i] = new Graphics::TBitmap();      Bmp[0]->Assign(Image1->Picture->Bitmap);
  Bmp[1]->Assign(Image2->Picture->Bitmap);
  Bmp[2]->Assign(Image3->Picture->Bitmap);
  Bmp[3]->Assign(Image4->Picture->Bitmap);
  Byte *ptr1,*ptr2,*ptr3,*ptr4;
  int temp[4];                  for (int i=0;iHeight;i  )/*取值相減*/
   {
    ptr1=(Byte *)Bmp[0]->ScanLine[i];
    ptr2=(Byte *)Bmp[1]->ScanLine[i];
    ptr3=(Byte *)Bmp[2]->ScanLine[i];
    ptr4=(Byte *)Bmp[3]->ScanLine[i];
    for(int j=0;jWidth;j  )
     {
      temp[1] =abs((int)ptr1[3*j]-(int)ptr2[3*j]);
      temp[2] =abs((int)ptr1[3*j]-(int)ptr3[3*j]);
      temp[3] =abs((int)ptr1[3*j]-(int)ptr4[3*j]);
     }
   }
   int record[4] = {0, 1, 2, 3};       int tp;   /*泡沫排序*/
   for(int x=0;x<4;x  )
   {
    for(int i=1;i<4;i  )
    {
     if(temp[i 1] < temp[i])
     {
       tp=temp[i];
       temp[i]=temp[i 1];
       temp[i 1]=tp;           tp = record[i];
       record[i] = record[i 1];
       record[i 1] = tp;         }
    }
   }
    Image5->Picture->Assign(Bmp[record[1]]);          }
    } while (FindNext(sr) == 0);
    FindClose(sr);
  }    }
JerryKuo
版主


發表:42
回覆:571
積分:322
註冊:2003-03-10

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-09-02 15:05:20 IP:220.135.xxx.xxx 未訂閱
系統時間:2024-05-02 21:29:42
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!