It is probably a simple thing to do for experienced delphi coders, but, I am not one so, help me out if you can.

Moderator: 2ffat
Why not? What EXACTLY are you having trouble with during the conversion? What does your C++ code look like that is not working for you? Are you getting any errors with it? Please be more specific.theLizard wrote:Wanting something to do I played around with TZipFile but cannot understand how to implement the OnProgress event, I have seen a delphi example https://stackoverflow.com/questions/519 ... ipprogress but I don't know anything about delphi, I can read and sort of understand but cannot convert it to the c++ equivilent.
Initially, before finding the delphi example, I assigned a method to the OnProgress event (as I thought this was the procedure), when adding a file via the Add(filename) which triggers the OnProgress event, I got access violations.theLizard wrote:Why not? What EXACTLY are you having trouble with during the conversion?
Code: Select all
#ifndef TLZipH
#define TLZipH
// ---------------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Classes.hpp>
// ---------------------------------------------------------------------------------
#include <vcl.h>
#include <vector>
#include <windows.h>
#include "system.zip.hpp"
// ---------------------------------------------------------------------------------
class PACKAGE TLZip : public TComponent
{
typedef void __fastcall (__closure *TZipProgressEvent)(System::TObject* Sender, System::UnicodeString FileName, const TZipHeader &Header, __int64 Position);
private:
TZipProgressEvent FOnProgress;
TZipFile* zip;
UnicodeString fileName;
TZipFile* __fastcall getZip();
protected:
public:
__fastcall TLZip(TComponent* Owner);
__fastcall ~TLZip();
UnicodeString __fastcall getFileName();
void __fastcall setFileName(UnicodeString value );
__published:
__property UnicodeString FileName = { read = getFileName, write = setFileName };
__property TZipProgressEvent Progress = {read=FOnProgress, write = FOnProgress};
__property TZipFile* Zip = {read=getZip};
};
// ---------------------------------------------------------------------------------
#endif
Code: Select all
#include <vcl.h>
#pragma hdrstop
// ---------------------------------------------------------------------------------
#include "TLZip.h"
#pragma package(smart_init)
// ---------------------------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
// ---------------------------------------------------------------------------------
static inline void ValidCtrCheck(TLZip *)
{
new TLZip(NULL);
}
// ---------------------------------------------------------------------------------
// -----| TLZip |----------
// ---------------------------------------------------------------------------------
__fastcall TLZip::TLZip(TComponent* Owner) : TComponent(Owner)
{
zip = new TZipFile();
//zip->OnProgress = &MyProgress;
}
// ---------------------------------------------------------------------------------
__fastcall TLZip::~TLZip()
{
if(zip)
delete zip;
}
// ---------------------------------------------------------------------------------
UnicodeString __fastcall TLZip::getFileName() //public
{
return(fileName);
}
// ---------------------------------------------------------------------------------
void __fastcall TLZip::setFileName(UnicodeString value ) //public
{
if(fileName != value)
fileName = value;
}
// ---------------------------------------------------------------------------------
TZipFile* __fastcall TLZip::getZip()
{
return(zip);
}
// ---------------------------------------------------------------------------------
namespace Tlzip
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TLZip)};
RegisterComponents(L"bcbh", classes, 0);
}
}
Code: Select all
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "TfrmZip.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "TLAgent"
#pragma link "TLEdit"
#pragma link "TLDirDlg"
#pragma link "TLCheckListBox"
#pragma link "TLZip"
#pragma resource "*.dfm"
TfrmZip *frmZip;
unsigned short word;
//---------------------------------------------------------------------------
__fastcall TfrmZip::TfrmZip(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::Button1Click(TObject *Sender)
{
if(!dlg->Execute())
return;
lb_Open->Clear();
for(int i=0; i < dlg->Files->Count; i++)
{
lb_Open->Items->Add(dlg->Files->Strings[i]);
}
if(lb_Open->Items->Count > 0)
lb_Open->CheckAll(1, false, false);
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::Button2Click(TObject *Sender)
{
if(!dlgSave->Execute())
return;
zipit->Zip->Open(dlgSave->FileName, zmWrite);
for(int i = 0; i < lb_Open->Items->Count; i++)
{
zipit->Zip->Add(lb_Open->Items->Strings[i]);
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::zipitProgress(TObject *Sender, UnicodeString FileName, const TZipHeader &Header,
__int64 Position)
{
pb->Position = Position;
}
//---------------------------------------------------------------------------
Then please show THAT code, and indicate WHERE the AccessViolation is occuring.theLizard wrote:Initially, before finding the delphi example, I assigned a method to the OnProgress event (as I thought this was the procedure), when adding a file via the Add(filename) which triggers the OnProgress event, I got access violations.
You DO NOT need to make a new component just to use the OnProgress event. And the code in the SO post you linked to does not make a whole new component, just a small utility class, which you can also do in C++, eg:theLizard wrote:I am sure I am doing it all wrong but, going by the answer on the stack overflow response I thought that creating a component would be the object that allowed me to have access to the OnProgress event, I am doing something wrong.
Code: Select all
class TMyZipProgress : public TObject
{
public:
__classmethod void __fastcall ShowZipProgress(TObject *Sender, String FileName, const TZipHeader &Header , __int64 Position);
};
void __fastcall TMyZipProgress::ShowZipProgress(TObject *Sender, String FileName, const TZipHeader &Header , __int64 Position)
{
// Show progress as needed...
}
...
TZipFile *FZip = new TZipFile;
FZip->OnProgress = &TMyZipProgress::ShowZipProgess;
...
delete FZip;
Code: Select all
#ifndef TLZipH
#define TLZipH
// ---------------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <System.Zip.hpp>
// ---------------------------------------------------------------------------------
class PACKAGE TLZip : public TComponent
{
private:
TZipProgressEvent FOnProgress;
TZipFile* FZip;
UnicodeString FFileName;
void __fastcall MyProgress(TObject* ASender, UnicodeString AFileName, const TZipHeader &AHeader, __int64 APosition);
public:
__fastcall TLZip(TComponent* Owner);
__fastcall ~TLZip();
__property TZipFile* Zip = {read=FZip};
__published:
__property UnicodeString FileName = {read=FFileName, write=FFileName};
__property TZipProgressEvent OnProgress = {read=FOnProgress, write=FOnProgress};
};
// ---------------------------------------------------------------------------------
#endif
Code: Select all
#include <vcl.h>
#pragma hdrstop
// ---------------------------------------------------------------------------------
#include "TLZip.h"
#include <System.SysUtils.hpp>
#pragma package(smart_init)
// ---------------------------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
// ---------------------------------------------------------------------------------
static inline void ValidCtrCheck(TLZip *)
{
new TLZip(NULL);
}
// ---------------------------------------------------------------------------------
// -----| TLZip |----------
// ---------------------------------------------------------------------------------
__fastcall TLZip::TLZip(TComponent* Owner) : TComponent(Owner)
{
FZip = new TZipFile();
FZip->OnProgress = &MyProgress;
}
// ---------------------------------------------------------------------------------
__fastcall TLZip::~TLZip()
{
delete FZip;
}
// ---------------------------------------------------------------------------------
void __fastcall TLZip::MyProgress(TObject* ASender, UnicodeString AFileName,
const TZipHeader &AHeader, __int64 APosition)
{
if (FOnProgress)
FOnProgress(this, AFileName, AHeader, APosition);
}
// ---------------------------------------------------------------------------------
namespace Tlzip
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TLZip)};
RegisterComponents(L"bcbh", classes, 0);
}
}
Code: Select all
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "TfrmZip.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "TLAgent"
#pragma link "TLEdit"
#pragma link "TLDirDlg"
#pragma link "TLCheckListBox"
#pragma link "TLZip"
#pragma resource "*.dfm"
TfrmZip *frmZip;
unsigned short word;
//---------------------------------------------------------------------------
__fastcall TfrmZip::TfrmZip(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::Button1Click(TObject *Sender)
{
if (!dlg->Execute())
return;
lb_Open->Clear();
for(int i=0; i < dlg->Files->Count; ++i)
{
lb_Open->Items->Add(dlg->Files->Strings[i]);
}
if (lb_Open->Items->Count > 0)
lb_Open->CheckAll(1, false, false);
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::Button2Click(TObject *Sender)
{
if (!dlgSave->Execute())
return;
zipit->Zip->Open(dlgSave->FileName, zmWrite);
for(int i = 0; i < lb_Open->Items->Count; ++i)
{
zipit->Zip->Add(lb_Open->Items->Strings[i]);
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::zipitProgress(TObject *Sender, UnicodeString FileName,
const TZipHeader &Header, __int64 Position)
{
pb->Position = Position;
}
//---------------------------------------------------------------------------
I don't have that code anymore but the code threw the error after assigning an event handler to the OnProgress event and as a file was being added to the zip, the access violation was triggered at the point where OnProgress event was triggered by the TZipFile->Add(file).rlebeau wrote:Then please show THAT code, and indicate WHERE the AccessViolation is occuring.
Yes, I am well aware of that, I am making it a component for a learning exercise and convinience if ever I need to include a zip function in apps.rlebeau wrote:You DO NOT need to make a new component just to use the OnProgress event.
rlebeau wrote:But, if you want to use your own component, then try something more like this:
Code: Select all
void __fastcall MyProgress(TObject* ASender, UnicodeString AFileName, const TZipHeader &AHeader, __int64 APosition);
Code: Select all
if (FOnProgress)
FOnProgress(this, AFileName, AHeader, APosition);
Code: Select all
if(!zipit->FileExplorerShow(0, zipit->ZipPath.w_str() /* or zipit->InitFolder */, false))
return;
Code: Select all
#include <vcl.h>
#pragma hdrstop
// ---------------------------------------------------------------------------------
#include "TLZip.h"
#pragma package(smart_init)
// ---------------------------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
// ---------------------------------------------------------------------------------
static inline void ValidCtrCheck(TLZip *)
{
new TLZip(NULL);
}
// ---------------------------------------------------------------------------------
// -----| TLZip |----------
// ---------------------------------------------------------------------------------
__fastcall TLZip::TLZip(TComponent* Owner) : TComponent(Owner)
{
FZip = new TZipFile();
FZip->OnProgress = &MyProgress;
/*
FZipFileName;
FZipPath;
FZipInitDrive;
FZipDestination;
FInitFolder;
*/
}
// ---------------------------------------------------------------------------------
__fastcall TLZip::~TLZip()
{
if(FZip)
delete FZip;
}
// ---------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------
bool __fastcall TLZip::FileExplorerShow(HWND Owner, wchar_t *path, bool dirsOnly )
{
success = false;
wchar_t* g_path;
IShellItem *shellItem;
HRESULT result = ::SHCreateItemFromParsingName(path,0,IID_IShellItem,reinterpret_cast<void**>(&shellItem));
if(dirsOnly)
FdialogOptions = FOS_PICKFOLDERS;
else
FdialogOptions = FOS_ALLOWMULTISELECT;
IFileOpenDialog *pfd;
if (SUCCEEDED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pfd))))
{
if (SUCCEEDED(result) && path != NULL )
pfd->SetFolder(shellItem);
DWORD dwOptions;
if (SUCCEEDED(pfd->GetOptions(&dwOptions)))
{
pfd->SetOptions(dwOptions | FdialogOptions /*FOS_PICKFOLDERS*/);
}
if (SUCCEEDED(pfd->Show(NULL)))
{
IShellItemArray *psa;
if(SUCCEEDED(pfd->GetResults(&psa)))
{
if (FAILED (hr))
MessageBoxW(0, L"Can't get FileOpenDialog Results: %s", L"Oops", 0);
hr = psa->GetCount(&count);
if (FAILED (hr))
MessageBoxW(0, L"Can't get FileOpenDialog Results Count: %s", L"Oops", 0);
if(count > 0)
success = true;
for (int i = 0; i < (int)count; i++)
{
IShellItem *item;
hr = psa->GetItemAt(i, &item);
if (FAILED (hr))
MessageBoxW(0, L"Can't get FileOpenDialog GetItemAt: %s", L"Oops", 0);
hr = item->GetDisplayName(SIGDN_FILESYSPATH, &g_path);
if (FAILED (hr))
MessageBoxW(0, L"Can't get FileOpenDialog GetDisplayName: %s", L"Oops", 0);
if(dirsOnly && SUCCEEDED (hr)) // this applies only if call was made to get folder name for
{ // compressing all files in source folder
FSelectedFolder = g_path;
success = true;
break;
}
if(SUCCEEDED (hr))
{
file = new TFileInfo();
file->FileInfoPath = ExtractFilePath(g_path);
file->FileInfoName = ExtractFileName(g_path);
file->FullFilePath = g_path;
filelist.push_back(file);
}
item->Release();
}
psa->Release();
}
}
if(pfd)
pfd->Release();
}
return(success);
}
// ---------------------------------------------------------------------------------
void __fastcall TLZip::MyProgress(TObject* ASender, UnicodeString AFileName, const TZipHeader &AHeader, __int64 APosition)
{
if (FOnProgress)
FOnProgress(this, AFileName, AHeader, APosition);
}
// ---------------------------------------------------------------------------------
UnicodeString __fastcall TLZip::getZipFileName()
{
return(FZipFileName);
}
// ---------------------------------------------------------------------------------
void __fastcall TLZip::setZipFileName(UnicodeString value)
{
if(FZipFileName != value)
FZipFileName = value;
}
// ---------------------------------------------------------------------------------
UnicodeString __fastcall TLZip::getZipPath()
{
return(FZipPath);
}
// ---------------------------------------------------------------------------------
void __fastcall TLZip::setZipPath(UnicodeString value)
{
if(FZipPath != value)
FZipPath = value;
}
// ---------------------------------------------------------------------------------
UnicodeString __fastcall TLZip::getZipInitDrive()
{
return(FZipInitDrive);
}
// ---------------------------------------------------------------------------------
void __fastcall TLZip::setZipInitDrive(UnicodeString value)
{
if(FZipInitDrive != value)
FZipInitDrive = value;
}
// ---------------------------------------------------------------------------------
UnicodeString __fastcall TLZip::getZipDestination()
{
return(FZipDestination);
}
// ---------------------------------------------------------------------------------
void __fastcall TLZip::setZipDestination(UnicodeString value)
{
if(FZipDestination != value)
FZipDestination = value;
}
// ---------------------------------------------------------------------------------
UnicodeString __fastcall TLZip::getInitFolder()
{
return(FInitFolder);
}
// ---------------------------------------------------------------------------------
void __fastcall TLZip::setInitFolder(UnicodeString value)
{
if(FInitFolder != value)
FInitFolder = value;
}
// ---------------------------------------------------------------------------------
UnicodeString __fastcall TLZip::getSelectedFolder()
{
return(FSelectedFolder);
}
// ---------------------------------------------------------------------------------
void __fastcall TLZip::setSelectedFolder(UnicodeString value)
{
if(FSelectedFolder != value)
FSelectedFolder = value;
}
// ---------------------------------------------------------------------------------
namespace Tlzip
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TLZip)};
RegisterComponents(L"bcbh", classes, 0);
}
}
Code: Select all
#ifndef TLZipH
#define TLZipH
// ---------------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Classes.hpp>
// ---------------------------------------------------------------------------------
#include <vcl.h>
#include <vector>
#include <windows.h>
#include "system.zip.hpp"
#include "TLFileInfo.h"
// ---------------------------------------------------------------------------------
class PACKAGE TLZip : public TComponent
{
//enum ZipMode { zmClosed, zmRead, zmReadWrite, zmWrite };
private:
DWORD FdialogOptions, count;
HRESULT hr;
LPWSTR* name;
TFileInfo* file;
TZipProgressEvent FOnProgress;
TZipMode FMode;
TZipFile* FZip;
UnicodeString FZipFileName;
UnicodeString FZipPath;
UnicodeString FZipInitDrive;
UnicodeString FZipDestination;
UnicodeString FInitFolder;
UnicodeString FSelectedFolder;
bool FZipDirectory;
UnicodeString __fastcall getZipFileName();
void __fastcall setZipFileName(UnicodeString value);
UnicodeString __fastcall getZipPath();
void __fastcall setZipPath(UnicodeString value);
UnicodeString __fastcall getZipInitDrive();
void __fastcall setZipInitDrive(UnicodeString value);
UnicodeString __fastcall getZipDestination();
void __fastcall setZipDestination(UnicodeString value);
UnicodeString __fastcall getInitFolder();
void __fastcall setInitFolder(UnicodeString value);
UnicodeString __fastcall getSelectedFolder();
void __fastcall setSelectedFolder(UnicodeString value);
// TZipFile* __fastcall getZip();
void __fastcall MyProgress(TObject* ASender, UnicodeString AFileName, const TZipHeader &AHeader, __int64 APosition);
protected:
bool success;
public:
__fastcall TLZip(TComponent* Owner);
__fastcall ~TLZip();
bool __fastcall FileExplorerShow(HWND Owner, wchar_t *path, bool dirsOnly );
std::vector<TFileInfo*> filelist;
__published:
__property TZipProgressEvent Progress = {read=FOnProgress, write = FOnProgress};
__property TZipFile* Agent = {read=FZip};
__property TZipMode Mode = {read=FMode, write=FMode};
__property UnicodeString ZipFileName = {read=getZipFileName, write=setZipFileName};
__property UnicodeString ZipPath = {read=getZipPath, write=setZipPath};
__property UnicodeString ZipInitDrive = {read=getZipInitDrive, write=setZipInitDrive};
__property UnicodeString ZipDestination = {read=getZipDestination, write=setZipDestination};
__property UnicodeString InitFolder = {read=getInitFolder, write=setInitFolder};
__property UnicodeString SelectedFolder = {read=getSelectedFolder, write=setSelectedFolder};
};
// ---------------------------------------------------------------------------------
#endif
Code: Select all
//---------------------------------------------------------------------------
#pragma hdrstop
#include "TLFileInfo.h"
//---------------------------------------------------------------------------
__fastcall TFileInfo::TFileInfo()
{
}
//---------------------------------------------------------------------------
UnicodeString __fastcall TFileInfo::getFullFilePath()
{
return(FFullFilePath );
}
//---------------------------------------------------------------------------
void __fastcall TFileInfo::setFullFilePath(UnicodeString value)
{
if(FFullFilePath != value)
FFullFilePath = value;
}
//---------------------------------------------------------------------------
UnicodeString __fastcall TFileInfo::getFileInfoName()
{
return(FFileInfoName);
}
//---------------------------------------------------------------------------
void __fastcall TFileInfo::setFileInfoName(UnicodeString value)
{
if(FFileInfoName != value)
FFileInfoName = value;
}
//---------------------------------------------------------------------------
UnicodeString __fastcall TFileInfo::getFileInfoPath()
{
return(FFileInfoPath);
}
//---------------------------------------------------------------------------
void __fastcall TFileInfo::setFileInfoPath(UnicodeString value)
{
if(FFileInfoPath != value)
FFileInfoPath = value;
}
#pragma package(smart_init)
Code: Select all
//---------------------------------------------------------------------------
#pragma hdrstop
#include "TLFileInfo.h"
//---------------------------------------------------------------------------
__fastcall TFileInfo::TFileInfo()
{
}
//---------------------------------------------------------------------------
UnicodeString __fastcall TFileInfo::getFullFilePath()
{
return(FFullFilePath );
}
//---------------------------------------------------------------------------
void __fastcall TFileInfo::setFullFilePath(UnicodeString value)
{
if(FFullFilePath != value)
FFullFilePath = value;
}
//---------------------------------------------------------------------------
UnicodeString __fastcall TFileInfo::getFileInfoName()
{
return(FFileInfoName);
}
//---------------------------------------------------------------------------
void __fastcall TFileInfo::setFileInfoName(UnicodeString value)
{
if(FFileInfoName != value)
FFileInfoName = value;
}
//---------------------------------------------------------------------------
UnicodeString __fastcall TFileInfo::getFileInfoPath()
{
return(FFileInfoPath);
}
//---------------------------------------------------------------------------
void __fastcall TFileInfo::setFileInfoPath(UnicodeString value)
{
if(FFileInfoPath != value)
FFileInfoPath = value;
}
#pragma package(smart_init)
Code: Select all
#include <vcl.h>
#pragma hdrstop
#include "TfrmZip.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "TLAgent"
#pragma link "TLEdit"
#pragma link "TLDirDlg"
#pragma link "TLCheckListBox"
#pragma link "TLZip"
#pragma link "TLApplication"
#pragma resource "*.dfm"
TfrmZip *frmZip;
unsigned short word;
//---------------------------------------------------------------------------
__fastcall TfrmZip::TfrmZip(TComponent* Owner)
: TForm(Owner)
{
/*
https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifileopendialog-getresults
*/
app->ApplicationPath = app->ExtractDebug(ExtractFilePath(Application->ExeName));
zipit->InitFolder = app->ApplicationPath;
zipit->ZipDestination = zipit->InitFolder;
zipit->ZipPath = ExtractFileDrive(zipit->InitFolder);
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::bnSelectFilesClick(TObject *Sender)
{
zipit->filelist.clear();
zipit->FileExplorerShow(0, zipit->InitFolder.w_str(), false);
if(zipit->filelist.size() > 0)
lb_Open->Clear();
for(int i=0; i < zipit->filelist.size(); i++)
{
lb_Open->Items->Add( zipit->filelist[i]->FileInfoName);
}
if(lb_Open->Items->Count > 0)
lb_Open->CheckAll(1, false, false);
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::bnCompressClick(TObject *Sender)
{
if(!dlgSave->Execute())
return;
pb->Position = 0;
zipit->Agent->Open(dlgSave->FileName, zmWrite);
for(int i = 0; i < zipit->filelist.size(); i++)
{
pb->Position = 0;
zipit->Agent->Add(zipit->filelist[i]->FullFilePath);
Application->ProcessMessages();
}
zipit->Agent->Close();
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::zipitProgress(TObject *Sender, UnicodeString FileName, const TZipHeader &Header, __int64 Position)
{
pb->Position = Position;
Application->ProcessMessages();
sb->SimpleText = FileName;
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::bnOpenZipClick(TObject *Sender)
{
//standard dialog for testing purpose
if(!dlg->Execute())
return;
zipit->Agent->Open(dlg->FileName, zmRead);
if(zipit->Agent->FileCount > 0)
{
lb_Progress->Items->AddStrings(zipit->Agent->FileNames);
}
zipit->Agent->Close();
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::lb_OpenClick(TObject *Sender)
{
if(lb_Open->Items->Count > 0)
{
sb->SimpleText = zipit->filelist[lb_Open->ItemIndex]->FullFilePath;
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::bnExploreClick(TObject *Sender)
{
if(!zipit->FileExplorerShow(0, zipit->ZipPath.w_str(), false))
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmZip::bnSelectFolderClick(TObject *Sender)
{
zipit->FileExplorerShow(0, zipit->InitFolder.w_str(), true);
zipit->SelectedFolder;
}
//---------------------------------------------------------------------------
Oops, completely missed itHsiaLin wrote:Seems you pasted the fileinfo cpp code to the h code too.
Code: Select all
//---------------------------------------------------------------------------
#ifndef TLFileInfoH
#define TLFileInfoH
#include <SysUtils.hpp>
#include <Classes.hpp>
// ---------------------------------------------------------------------------------
#include <StdCtrls.hpp>
#include <vector>
//---------------------------------------------------------------------------
class TFileInfo
{
private:
UnicodeString FFileInfoName;
UnicodeString FFileInfoPath;
UnicodeString FFullFilePath;
UnicodeString __fastcall getFullFilePath();
void __fastcall setFullFilePath(UnicodeString value);
UnicodeString __fastcall getFileInfoName();
void __fastcall setFileInfoName(UnicodeString value);
UnicodeString __fastcall getFileInfoPath();
void __fastcall setFileInfoPath(UnicodeString value);
public:
__fastcall TFileInfo();
__property UnicodeString FullFilePath = {read=getFullFilePath, write = setFullFilePath};
__property UnicodeString FileInfoName = {read=getFileInfoName, write = setFileInfoName};
__property UnicodeString FileInfoPath = {read=getFileInfoPath, write = setFileInfoPath};
};
#endif