今回は、LHA(LZH)形式による圧縮/解凍プログラムを紹介する。
@まずは UnLha32 を用意する
下記のサイトからUnLha32をダウンロードする。
Micco's HomePage
http://www2.nsknet.or.jp/~micco/micindex.html
このパッケージから「UNLHA32.H」と「UNLHA32.DLL」を取得して使用する。
(標準で含まれている「UnLha32.LIB」は使用しない。)
A以下の手順でインポートライブラリを作成する
・「UnLha32.DLL」を適当なフォルダにコピーする
・コマンドプロンプトを開き、上記のフォルダに移動する
・「IMPLIB UnLha32.LIB UnLha32.DLL」を実行して LIBファイル(インポートライブラリ) を作成する
Bプロジェクトを作成して、上記で作成したインポートライブラリ(.LIB)をプロジェクトに追加する。
Cフォームにボタン×2、メモ×1を配置して、下記の画面を作成する
また、画面にTOpenDialogを貼り付け、OpenDialog1の「ofAllowMultiSelect」は「true」にする。
(要は、圧縮の際、複数のファイルを選択できるようにする。)
D「Unit1.h」に「FileCtrl.hpp」を include する
E「Unit1.cpp」を下記のように編集する
| //--------------------------------------------------------------------------- #include #include #include #pragma hdrstop #include "Unit1.h" #include "unlha32.h" //追加 //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- //圧縮 void __fastcall TForm1::Button1Click(TObject *Sender) { //オープンダイアログ実行 if (OpenDialog1->Execute() == true) { //オープンダイアログでファイルが選択された場合 AnsiString asParam; for (int index = 0; index < OpenDialog1->Files->Count; index++) { //選択されたファイル名をスペースで区切って1つの文字列にする asParam += " " + OpenDialog1->Files->Strings[index]; } //セーブダイアログの初期ディレクトリを設定 SaveDialog1->InitialDir = ExtractFileDir(OpenDialog1->FileName); //セーブダイアログ実行 if (SaveDialog1->Execute()) { //セーブダイアログで圧縮ファイル名が指定された場合 //パラメータ文字列の作成 asParam = "a " + SaveDialog1->FileName + asParam; //圧縮処理 char bResult[4096]; int ret = Unlha(Handle, asParam.c_str(), bResult, sizeof(bResult)); if (ret == 0) { //処理結果が正常の場合 Memo1->Lines->Add(bResult); Memo1->Lines->Add("圧縮完了"); }else { //処理結果が異常の場合 Memo1->Lines->Add("圧縮エラー"); } } } } //--------------------------------------------------------------------------- //解凍 void __fastcall TForm1::Button2Click(TObject *Sender) { //オープンダイアログ実行 if (OpenDialog1->Execute()) { //オープンダイアログでファイルが選択された場合 //展開先のディレクトリを選択する AnsiString SelectDir; if (SelectDirectory("タイトル名", "\\", SelectDir)) { //ディレクトリが選択された場合 //ディレクトリ名の最後に"\"を付加 SelectDir = IncludeTrailingBackslash(SelectDir); //パラメータ文字列作成 AnsiString asParam; asParam = "x " + OpenDialog1->FileName + " " + SelectDir; //解凍処理 char bResult[4096]; int ret = Unlha(Handle, asParam.c_str(), bResult, sizeof(bResult)); if (ret == 0) { //処理結果が正常の場合 Memo1->Lines->Add(bResult); Memo1->Lines->Add("解凍完了"); }else { //処理結果が異常の場合 Memo1->Lines->Add("解凍エラー"); } } } } //--------------------------------------------------------------------------- |
Fできあがり
圧縮、解凍のテストを行う。
尚、ファイル圧縮時のファイル選択では、複数のファイルを選択できる。
G以下はソースと実行ファイル。
開発環境 (lha_src.zip)
実行ファイル (lha_exe.zip)
・・・もし、これらの情報が少しでも役に立ったら、右上の広告をクリックしてほしいな・・・。m(__)m




最近Builder触ってないなぁ・・。
時間が経つと、自分が書いたプログラム
さえ読めなくなってしまうんですよね。
(´・ω・`)
C++Builderは、ここしばらく全然アップグレードされていないんですけど、次のDelphiに統合されたら、どうなるんでしょうかね。
springbreak amatuer sex nvw http://amatuer.bluesauce.com/springbreak-amatuer-sex.html springbreak amatuer sex
phone sex amatuer nvw http://amatuer.bluesauce.com/phone-sex-amatuer.html phone sex amatuer
free teen amatuer porn nvw http://amatuer.bluesauce.com/free-teen-amatuer-porn.html free teen amatuer porn
swinging amatuer porn nvw http://amatuer.bluesauce.com/swinging-amatuer-porn.html swinging amatuer porn
free amatuer video sex nvw http://amatuer.bluesauce.com/free-amatuer-video-sex.html free amatuer video sex
amatuer hot anal sex nvw http://amatuer.bluesauce.com/amatuer-hot-anal-sex.html amatuer hot anal sex
amatuer lesbo porn nvw http://amatuer.bluesauce.com/amatuer-lesbo-porn.html amatuer lesbo porn
amatuer ass sex nvw http://amatuer.bluesauce.com/amatuer-ass-sex.html amatuer ass sex
search amatuer wife gallery sex nvw http://amatuer.bluesauce.com/search-amatuer-wife-gallery-sex.html search amatuer wife gallery sex
amatuer latina porn nvw http://amatuer.bluesauce.com/amatuer-latina-porn.html amatuer latina porn
women amatuer nude photo nvw http://amatuer.bluesauce.com/women-amatuer-nude-photo.html women amatuer nude photo
hot amatuer porn nvw http://amatuer.bluesauce.com/hot-amatuer-porn.html hot amatuer porn
free swinging amatuer porn samples nvw http://amatuer.bluesauce.com/free-swinging-amatuer-porn-samples.html free swinging amatuer porn samples
amatuer videos sex nvw http://amatuer.bluesauce.com/amatuer-videos-sex.html amatuer videos sex
amatuer sex family nvw http://amatuer.bluesauce.com/amatuer-sex-family.html amatuer sex family
mobile phone amatuer sex pic nvw http://amatuer.bluesauce.com/mobile-phone-amatuer-sex-pic.html mobile phone amatuer sex pic
redhead amatuer porn free nvw http://amatuer.bluesauce.com/redhead-amatuer-porn-free.html redhead amatuer porn free
canada women amatuer nvw http://amatuer.bluesauce.com/canada-women-amatuer.html canada women amatuer
amatuer high school sex nvw http://amatuer.bluesauce.com/amatuer-high-school-sex.html amatuer high school sex
amatuer wife and husband sex tapes nvw http://amatuer.bluesauce.com/amatuer-wife-and-husband-sex-tapes.html amatuer wife and husband sex tapes
amatuer video uk sex nvw http://amatuer.bluesauce.com/amatuer-video-uk-sex.html amatuer video uk sex
amatuer sex chat rooms nvw http://amatuer.bluesauce.com/amatuer-sex-chat-rooms.html amatuer sex chat rooms
usa amatuer porn nvw http://amatuer.bluesauce.com/usa-amatuer-porn.html usa amatuer porn
couples amatuer sex pictures nvw http://amatuer.bluesauce.com/couples-amatuer-sex-pictures.html couples amatuer sex pictures
free amatuer sex gallery nvw http://amatuer.bluesauce.com/free-amatuer-sex-gallery.html free amatuer sex gallery
amatuer home made porn video nvw http://amatuer.bluesauce.com/amatuer-home-made-porn-video.html amatuer home made porn video
amatuer sex couple nvw http://amatuer.bluesauce.com/amatuer-sex-couple.html amatuer sex couple
nude pics of amatuer girls nvw http://amatuer.bluesauce.com/nude-pics-of-amatuer-girls.html nude pics of amatuer girls
hot amatuer black girls nvw http://amatuer.bluesauce.com/hot-amatuer-black-girls.html hot amatuer black girls