portallkp.blogg.se

Curso delphi xe10
Curso delphi xe10










curso delphi xe10

To make work procedure use method write by Russell Ryan and this modification:

curso delphi xe10

Method with NumProcess don''t work on windows 7 and Delphi 2007. According to Microsoft this is intentional. Unfortunately, to compress files the flag to hide the shell progress dialog doesn't work. wait till all shell threads are terminated Srcfldr := shellobj.NameSpace(sourcefolder) Ms.WriteBuffer(emptyzip, sizeof(emptyzip)) counts the number of threads in the process To workaround this issue, we simply track the number of process threads and wait till all threads created by the shell are terminated.

curso delphi xe10

This is quite inconvenient if your code needs to do further actions on the compressed file. This means that the call to CopyHere() returns immediately and the shell creates threads that perform the actual compressing. Another problem with creating a ZIP file is that in this case the CopyHere() function is not blocking. This is fortunately easy and this is also what the proposed Delphi function here does. It is as such necessary to first create an empty ZIP file. To create a ZIP file, the Shell.Application CopyHere() API expects that the ZIP file already exists. This means that this function will return after all files are effectively unzipped. The call CopyHere() is blocking for unzipping files. In this function, the progress dialog has been set hidden (with the flag SHCONTCH_NOPROGRESSBOX). Shellfldritems.Filter(SHCONTF_INCLUDEHIDDEN or SHCONTF_NONFOLDERS or SHCONTF_FOLDERS,filter) ĭestfldr.CopyHere(shellfldritems, SHCONTCH_NOPROGRESSBOX or SHCONTCH_RESPONDYESTOALL) Shellobj := CreateOleObject('Shell.Application') ĭestfldr := shellobj.NameSpace(targetfolder) The filter parameter is optional and can be used to extract only files that match the filter condition.įunction ShellUnzip(zipfile, targetfolder: string filter: string = ''): boolean Here is a function for using the API from Delphi to unzip a file. This API makes it fairly easy to zip or unzip a ZIP file. And yes, it is effectively exposed, albeit in a limited way via OLE automation with Shell.Application. Using Windows Explorer from time to time to open ZIP files or create ZIP files, I knew that Windows can internally manage ZIP files so it was a matter of searching via what API this functionality is exposed to use it from applications.

curso delphi xe10

Zip and Unzip files in Delphi without using a 3rd party component












Curso delphi xe10