Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide ProgressBar in Zipping.

Status
Not open for further replies.
I don't think you have control over that, if so at the OS level in some setting, most probably buried in the registry.
What's more important, this works in Win8, too, but every file I zipped this way in a short test causes an error message window:

Title:Compressed (zipped) Folders Error
Message: File not found or no read permission.

The resulting zip file is containing all zipped files, nevertheless getting a message window per file is not bearable.

So using that OS capability has to be refined in some way to make better use of it, but why not use vfpcompression instead?
If you don't have the FLL that's one thing, as Craig Boyds site is down, but I have attached it here.

In regard of using it see thread184-1749461

Bye, Olaf.
 
 http://files.engineering.com/getfile.aspx?folder=94682740-9932-48fd-bcf1-8095274673a5&file=vfpcompression.zip
I struggled with this method when I created the copytoxlsx, copytodocx and copytopptx functions and classes.
The Folder.CopyHere method is asynchronous. The error is because it tries to start to compress almost instantaneously all the files.
To avoid that, I copied the files one by one.

1) I guess you can't hide the progress bar (but I might be wrong)
Here you might read about a second parameter (vOptions) but also there is a note
Note In some cases, such as compressed (.zip) files, some option flags may be ignored by design.
I tried, unsuccessfully, flag = 4.

2) You can detect by trying to open the zip file with FOPEN() in a loop
While FOPEN() < 0, the compression is not finished

Code:
DECLARE Sleep IN WIN32API INTEGER 

cFileZip = "D:\Kit\Zipdemo.ZIP"
cSource = "D:\Kit\Zipdemo\"

*****************************
* Preparations
*****************************
* Create three big files
* and 1000 small files
*****************************

IF !DIRECTORY(cSource)
	MD (cSource)
ENDIF
? "Create 1.5 GB of txt files. Please wait..."
STRTOFILE(SPACE(10000),cSource + "f1.txt")
FOR lnj = 1 TO 1000
	FOR lni = 0 TO 24
		STRTOFILE(REPLICATE(CHR(65 + m.lni),10000),cSource + "f1.txt",1)
		STRTOFILE(REPLICATE(CHR(97 + m.lni),10000),cSource + "f1.txt",1)
	NEXT
	STRTOFILE("1",cSource + "small" + TRANSFORM(m.lni) + ".txt")
NEXT
COPY FILE (cSource + "f1.txt") TO (cSource + "f2.txt")
COPY FILE (cSource + "f1.txt") TO (cSource + "f3.txt")
*********************
* end of preparations
*********************

strtofile(chr(0x50)+chr(0x4B)+chr(0x05)+chr(0x06)+replicate(chr(0),18),cFileZip)
o=CREATEOBJECT("shell.application")
llErr = .T.

FOR lni = 0 TO o.NameSpace(cSource).items.count - 1
	ofile = o.NameSpace(cSource).items.item(m.lni)
	o.NameSpace(cFileZip).copyhere(ofile,4)
	DO WHILE INLIST(o.NameSpace(cFileZip).items.count, 0, m.lni)
		sleep(50)
	ENDDO
ENDFOR

Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
 

1. Windows compression does not required fll/dll.
2. While compressing it does not block the application.
3. Good Speed.

Thanks for your reply
Best Regards.
 
1. you have the FLL/DLLs now, it's no big deal to put them in the app folder
2. vfpcompression also works in parallel, it has a callback (, if you want to show progress).
3. same speed, this is all standard algorithms.
4. you have more control over progress dialogs for example (see 2)
5. can be used from win98 to win10

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top