Delphi 2007 下UnRAR Delphi component該如何安裝使用?
官方有提供
UnRAR.dll UnRAR dynamic library for Windows software developers
UnRAR Delphi component Delphi component wrapper for UnRar.dll.
UnRAR source Portable UnRAR source code.
http://www.rarlab.com/rar_add.htm
把 TDFUnRar.zip 解壓縮, src目錄有 DFUnRar.pas 和 untUnRar.pas
Install.txt 最後3行安裝說明:
1. Copy the files UnRar.pas and untUnRar.pas into the $ (DELPHI) \ lib listing or a listing of your choice.
2. Menu option COMPONENT - COMPONENT INSTALLING select and the file UnRar.pas select
3. The new component is in register Frischa.
(Install.txt的英文翻譯版本請看 http://delphi.ktop.com.tw/board.php?cid=30&fid=69&tid=89988 )
TDFUnRar.zip (UnRAR Delphi component) 解壓縮後的Install.txt居然是德文
將它轉成英文, 張貼如下
DF UnRar
========
The releases 1,0, 04.03.2003
tested under Windows XP
over this program can do you:
- RSR archives unpack
- regard contents
- password support
- support of divided archives
- progress announcement and unpacking stop
- indicate all characteristics of the files in archives
- through click on the column headings can the sort direction be changed.
The provided Delphi component is a Wrapper for the UnRar DLL,
which is made available free of charge under http://www.rarlab.com.
References to the use find you in Readme.txt and in the source code: -).
untUnRar.pas - function definitions, structures and constants of the UnRar.dll
UnRar.pas - the component
The program DF UnRAR basisert on this
component and represents thus a small application of examples to their use.
It cannot be used naturally also by Delphianern. !!
They receive all sources for the Delphi component and the program DF UnRar.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Use of the program
========================
- FILE - OPENING - open RSR archives
- is needed a password, indicated a dialogue window.
If you enter a wrong password, no files in the list are indicated.
In the status dialogue an error is indicated.
- Knows the UnRar.dll with divided archives the next Volumn
will not find indicated likewise a dialogue window.
- a WORKING ON - UNPACKING - complete archives contents unpack
or files in the list with pressed Strg key mark.
If the file is already present, a dialogue window is opened.
- WORKING ON - status INFO. - announcement packed by information/errors
- WORKING ON - archives INFO. - announcement of the archives comment and the entire
file sizes/unpacked
Manual installation of the Delphi component
===========================================
1. Copy the files UnRar.pas and untUnRar.pas into the $ (DELPHI) \ lib listing or a listing of your choice.
2. Menu option COMPONENT - COMPONENT INSTALLING select and the file UnRar.pas select
3. The new component is in register Frischa.
原文說明要將 DFUnRar.pas 和 untUnRar.pas 拷貝到 C:\Program Files\CodeGear\RAD Studio\5.0\lib 目錄
然後選 Component 下拉選單的 COMPONENT INSTALLING , 但是 Delphi 2007 無此選項
而且C:\Program Files\CodeGear\RAD Studio\5.0\lib 目錄中沒有其他.pas, 主要是 .dcu
測試(1)
1.如果選 Import Component 選項
1.1選 Import a Type Library, 按下 Next 按鈕
按下 Add 按鈕, 檔案類型只有 Type Library (*.dll; *.ocx; *.olb; *.tlb)
1.2如果選 Import a ActiveX Control, 按下 Next 按鈕
按下 Add 按鈕, 檔案類型只有 Type Library (*.dll; *.ocx; *.olb; *.tlb)
2.Create Component Template不能選
3.選New VCL Component, 沒有 Add 按鈕
失敗 ~
測試(2)
Delphi 2007直接開啟 DFUnRar.pas, 檢查 Project, Run 或 Component 似乎都沒有方法去註冊安裝此元件
F9 (Run) 也沒用, 失敗 ~
測試(3)
因為lib下大都是.dcu, 想辦法建立吧 ~
在 src 目錄下建立 Delphi2007 子目錄, 把DFUnRar.pas 和 untUnRar.pas拷貝一份放入
執行 Delphi 2007
選 File 下拉選單, New 選項, VCL Forms Application - Delphi for Win32
選 Project 下拉選單, Add to Project 選項, 選 src/Delphi2007 目錄中 DFUnRar.pas;
再選 Project 下拉選單, Add to Project 選項, 選 src/Delphi2007 目錄中 untUnRar.pas
選 File 下拉選單, 選 Save Project As 選項, 將檔案存到 src/Delphi2007
按下F9去Run, 會在 src/Delphi2007 目錄中產生 untUnRar.dcu 和 DFUnRar.dcu
將 untUnRar.dcu 和 DFUnRar.dcu 拷貝到 C:\Program Files\CodeGear\RAD Studio\5.0\lib 目錄中
但是.dcu該如何註冊呢? 去開啟 TDFUnRar/demo 目錄的 UnRarDemo.dpr 會出現 Class TDFUnRar not found.
失敗 ~
測試(4)
把
把 TDFUnRar中 demo 目錄複製一份成為 demo2
把 src 目錄中的 DFUnRar.pas 和 untUnRar.pas拷貝一份放入 demo2
把 FreeWare 目錄中的 unrar.dll 拷貝一份放入 demo2
用Delphi 2007開啟demo2中的UnRarDemo.dpr,
選 Project 下拉選單, Add to Project 選項, 選 src/Delphi2007 目錄中 DFUnRar.pas (OK)
再選 Project 下拉選單, Add to Project 選項, 選 src/Delphi2007 目錄中 untUnRar.pas (失敗)
按下 F9(Run), 出現 [DCC Error] untUnRarDemo.pas(110): E2003 Undeclared identifier: 'FileList'
失敗 ~
請問有人知道該如何處理嗎?
===================
使用2006最近摸索出來的作法你看看行不行:
1. File | New | Package - Delphi for Win32
//此時程式會在預設路徑C:\Documents and Settings\user\My Documents\Borland Studio Projects路徑下Create bpl 的目錄
2. Save All
//預設路徑C:\Documents and Settings\user\My Documents\Borland Studio Projects下存檔
3.Add file to proejct 將 DFUnRar.pas .AND. untUnRar.pas Add 進來
4.RUN
//此時會出現error Cannot run project unless a host application is defined. Use the Run[Parameters... dialog box...
不知道是原本就這樣還是我有地方錯誤,這時在bpl下也create RARVCL.bpl & RARVCL.dcp 2
5.File | Colse All
6.Component | Install Package | Add 將預設路徑C:\Documents and Settings\user\My Documents\Borland Studio Projects\bpl下
將 xxx.bpl 檔加入 按下 OK 此時 Tool Palette 最後面會出現-DFrisch TDFUnrar元件
=======================
失敗 ~
因為 C:\Documents and Settings\(使用者登入帳號)\My Documents\RAD Studio\Projects 目錄中沒有bpl目錄, 也沒看到任何 .bpl 檔案, 您這招對 Delphi 2007 無用
========================
試試在 C:\Documents and Settings\allusers.windows\My Documents\RAD Studio\Projects 中找所要的檔案
=========================
實際測試了一下
C:\Documents and Settings\All Users 底下沒有 My Documents 目錄
===================引 用 ckwong2002 文 章===================
試試在 C:\Documents and Settings\allusers.windows\My Documents\RAD Studio\Projects 中找所要的檔案
========================
應該是
C:\Documents and Settings\allusers.windows\Documents\RAD Studio\Projects 中找所要的檔案
=======================
C:\Documents and Settings 下面沒有 allusers.windows 目錄
===================引 用 ckwong2002 文 章===================
應該是
C:\Documents and Settings\allusers.windows\Documents\RAD Studio\Projects 中找所要的檔案
========================
紅色字部份是你登入 Windows 的 user name (內定是Administrator), 並不是所有電腦都一定是一樣的.
C:\Documents and Settings\Administrator\My Documents (其實這個就是桌面上的 "我的文件")
===================引 用 pcboy 文 章===================
C:\Documents and Settings 下面沒有 allusers.windows 目錄
===================引 用 ckwong2002 文 章===================
應該是
C:\Documents and Settings\allusers.windows\Documents\RAD Studio\Projects 中找所要的檔案
===========================
我用 Delphi 2007 安裝成功了, 步驟如下 ...
1. 先造目錄 C:\Program Files\CodeGear\RAD Studio\5.0\Package Project
2. 將 TDFUnRar 解壓到 C:\Program Files\CodeGear\RAD Studio\5.0\USER\TDFUnRar
3. New -> Package - Delphi for Win32
4. Save as 存成 C:\Program Files\CodeGear\RAD Studio\5.0\Package Project\USER2007.*
5. Add C:\Program Files\CodeGear\RAD Studio\5.0\USER\TDFUnRar\src\DFUnRar.pas 到 USER2007.bpl 中
6. USER2007.bpl 檔名按右鍵選 Options -> Directories/Conditionals -> Output director 填入 C:\Program Files\CodeGear\RAD Studio\5.0\Package Project -> [OK]
7. USER2007.bpl 檔名按右鍵選 Install
Delphi 會強迫安裝到 C:\Documents and Settings\All Users\Documents\RAD Studio\5.0\Bpl (真是奇怪!)
另外, 因為你沒有打開 Windows 的目錄選項, 所以有些目錄你是看不到的(但不代表它不存在 ), 請複製上行粗體字貼到 "檔案總管" 的網址, 再按 [Enter] 就可以進入此目錄
元件表會多出一個 [DFrisch] 項目
=============================
(1)成功了, Tool Palette 多了 DFrisch 元件類, 裡面有 TDFUnRar 元件
也有 C:\Documents and Settings\All Users\Documents\RAD Studio\5.0\Bpl
感謝 danny 版主 (2)
小弟習慣安裝完 WinXP 後就顯示所有檔案和目錄, 所以應該不是隱藏問題[檔案總管]/[工具]下拉選單/[資料夾選項]/[檢視]標籤[]隱藏已知檔案類型的副檔名 <== 打勾取消
[]隱藏保護的作業系統檔案(建議使用) <== 打勾取消
隱藏檔案和資料夾
( )不顯示隱藏的檔案和資料夾
(*)顯示所有檔案和資料夾 <== 改選這個(3)小弟的帳號是Administrator (隨機版WinXP, 出廠就如此)
C:\Documents and Settings\Administrator\My Documents\RAD Studio\Projects\bpl確實不存在(剛剛又看了一次)
上一層的C:\Documents and Settings\Administrator\My Documents\RAD Studio\Projectsl也沒有任何 .bpl 檔案(剛剛又看了一次)
没有评论:
发表评论