用INDY9開發FTP客戶端_01

magus_yang發表於2004-12-09

用INDY9開發FTP客戶端_01

-- INDY9的安裝

Roger Yang

    最近寫了一個支援多執行緒、斷點續傳和下載限速功能的FTP客戶端

    開發工具使用BCB6+SP4和INDY 9.0.17。INDY9是一套很不錯的控制元件組,大大簡化了開發網路應用程式的難度。而且它是開源的。BCB6自帶的INDY版本比較舊,所以去INDY的官方網站http://www.indyproject.org/下載最新版本進行更新。官方網站上最新提供的下載版本是9.0.18,但感覺裡面檔案不全,幾個安裝需要的批處理檔案都沒有。所以我還是使用9.0.17。
    
    INDY9的安裝比較麻煩,下面是INDY官方網站上提供的一個安裝方法。
 · Close the Borland C++ Builder IDE if it is open.

 · Remove all Indy files including dclindy*.bpl, dclindy.*, dclindy*.bpl, indy*.lib, id*.pas, id*.hpp, id*.obj, and id*.dcu. Take care that you only remove the old Indy files and not something else. Be sure that you also remove any indy*.bpl from your Windows/System32 directory.

 · Remove all old Indy Help files, indy.*, from the Help subdirectory and replace them with the new ones.

 · Place the new version of Indy in a directory of your choice. When unzipping, please keep the /source directory for the archive intact because that is used by some build batch files.

 · In the source directory, there are several batch files. Run the appropriate one for your version of Borland C++ Builder:


  · FULLC4.BAT - Borland C++ Builder 4

  · FULLC5.BAT - Borland C++ Builder 5

  · FULLC6.BAT - Borland C++ Builder 6


 · These batch files create subdirectories in the main Indy directory folder. They are (C4 for C++Builder 4, C5 for C+Builder 5, and C6 for C++Builder 6). These directories contain:


  · The Indy .DCU files

  · The Indy .HPP files

  · The Indy .LIB file

  · The Indy .OBJ files

  · The Indy Design-Time .BPL


 · Open the Borland C++ Builder IDE.

 · In your C++Builder IDE, add the Indy design-time package with Component|Install Package...|Add... Go to the subdirectory where the Indy .DCU's and Design-Time .BPL was placed by the batch file. Add the Design-Time .BPL that is listed. It usually is named dclIndy followed by the Borland C++ Builder version and an 0.

 · Add the path where the .DCU's are located to your environment. Do this with Tools|Environment Options...|Library...|Library Path...

 · Add the path where the .HPP's are located to your project. Do this with Project|Options|Directories|Conditionals|Include path. Check the box Default and click OK to save this setting.

    這個方法要手工刪除INDY的舊檔案,很容易出錯,試過兩次都有些問題。
    我使用的是下面這個方法,操作起來相對簡單,而且仔細點是不會出錯的。
(1)移除 BCB6 中原本的 Indy
 (1.1)放入原本安裝 BCB6 的光碟片,選擇“C++ Builder 6”
 (1.2)在 Borland C++ Builder 6 Enterprise Edition - Installation
 Wizard 中,按“Next”
 (1.3)在“Program Maintenance”Dialog 中,選擇“Modify”然後按
 “Next”
 (1.4)在“Custom Setup”Dialog 中,點選“Program Files/Indy”節點,
 並選擇“Do not Install”然後按“Next”
 (1.5)剩下的步驟都按“Next”就可以將 BCB6 中原本的 Indy 給移除了
 
 (2)安裝新版本的 Indy (9.0.1X)
 (2.1)新版的 Indy (9.0.1X) 可在此下載
 http://www.indyproject.org/download/Indy9.html
 (2.2)將下載的檔案 IndyWin32_9_00_1X_Src.zip 解壓縮至目錄 C:/Indy
 (解壓縮後會多一個子目錄 C:/Indy/Source)
 (2.3)執行檔案 C:/Indy/Source/Fullc6.bat (Command line)
 (2.4)執行完成以後,會多一個子目錄 C:/Indy/C6
 
 (3)在 BCB6 中設定新版本的 Indy (9.0.11)
 (3.1)開啟 C++ Builder 6.0 (在開啟的過程中會出現連結不到 Indy Lib 的
 提示 Dialog,選擇 Yes 跳過)
 (3.2)在 BCB6 中選擇“Tools/Environment Options”
 (3.3)在“Environment Options”Dialog 中,選擇“Library”Tab
 (3.4)在“Library Path”欄位中加入字串“;C:/Indy/C6”,然後按“OK”
 Button
 (3.5)在 BCB6 中選擇“Project/Options”
 (3.6)在“Project Options”Dialog 中,選擇“Packages”Tab
 (3.7)按“Add”Button,並將檔案指向 C:/Indy/C6/dclIndy60.bpl
 (3.在“Project Options”Dialog 中,選擇“Directories /
 Conditionals”Tab
 (3.9)在“Include Path”及“Library Path”兩個欄位的最前面,分別加入
 字串“C:/Indy/C6;”
 (3.10)在“Project Options”Dialog 中,將左下角的“Default”打勾,然
 後按“OK”Button
 (3.11)把 BCB6 關閉,然後重新開啟,如果不會出現(3.1)中的 Dialog 的
 話,就代表已經設定成功

相關文章