Potrebno je da pomocu progres bara graficki prikazem koliko je vremena ostalo dok se ne zavrsi skeniranje nekog cd-a ili dvd-a. kAKO CU ZNATI KOLIKO JE VREMENA UOPSTE OSTALO DO KRAJA NEKAKVOG PROCESA?
progressbar kako znati duzinu procesa?
Zaključano
Zakačeno
Niko ne moze da ti kaze koliko je vremena ostalo do kraja nekog postupka
To samo ti znas.
Ako sabiras 10 brojeva onda znas da imas deset brojeva i mozes da ispises koliko si ih do sad sabrao, koliko je ostalo, koliko je procenata zavrseno, da, na osnovu vremena koje je trebalo da se saberu brojevi koje si vec obradio, prikazes jos koliko je vremena ostalo i slicno.
Ako kopiras fajl... znas da je fajl velicine, recimo, 700Mb... ovde ne sabiras brojeve nego kopiras podatke... ispises koliko si kopirao, koliko je ostalo, koliko je procenata zavrseno, itd...
Ako sabiras 10 brojeva onda znas da imas deset brojeva i mozes da ispises koliko si ih do sad sabrao, koliko je ostalo, koliko je procenata zavrseno, da, na osnovu vremena koje je trebalo da se saberu brojevi koje si vec obradio, prikazes jos koliko je vremena ostalo i slicno.
Ako kopiras fajl... znas da je fajl velicine, recimo, 700Mb... ovde ne sabiras brojeve nego kopiras podatke... ispises koliko si kopirao, koliko je ostalo, koliko je procenata zavrseno, itd...
Potpis
OK, ali meni je potrebno da procitam sve podatke o fajlovima na cd/dvd-u da bi znao koliko ih ima pa da odredim polozaj na trackbaru, a ja to znam tek kad izbrojim fajlove(koristim findfirts, findnext, findclose), a meni je podatak o broju fajova na cd-u potreban na pocetku samog brojanja.
mozda neko zna neku funkciju koja nam govori broj fajlova na nekom direktorijumu?
mozda neko zna neku funkciju koja nam govori broj fajlova na nekom direktorijumu?
Citat:
Bojann: OK, ali meni je potrebno da procitam sve podatke o fajlovima na cd/dvd-u da bi znao koliko ih ima pa da odredim polozaj na trackbaru, a ja to znam tek kad izbrojim fajlove(koristim findfirts, findnext, findclose), a meni je podatak o broju fajova na cd-u potreban na pocetku samog brojanja.
mozda neko zna neku funkciju koja nam govori broj fajlova na nekom direktorijumu?
mozda neko zna neku funkciju koja nam govori broj fajlova na nekom direktorijumu?
Ubaci komponentu TFileListBox i koristi funkciju FileListBox1.Count
Da, ali meni treba da prebrojava i fajlove u subfolderima
Takva funkcija ne postoji. Verovatno si primetio da kad obelezis neki folder sa puno podfoldera i fajlova i uradis copy + paste ili delete explorer kaze "Preparing to Copy/Delete". To je zato sto mora da prodje kroz sve fajlove, da ih izbroji/odredi velicinu pa tek onda pocinje sa kopiranjem/brisanjem da bi mogao da prikaze progress bar.
Potpis
Ako sam dobro razumeo ti treba da prebrojis fajlove na tom cd-u?
Ako je to,onda malo prepravi onu funkciju sto trazi fajlove po "dubini".Dodaj jednu promenjivu koja ce se povecati svaki put kad se nadje neki fajl.
Pozzzz!
Ako je to,onda malo prepravi onu funkciju sto trazi fajlove po "dubini".Dodaj jednu promenjivu koja ce se povecati svaki put kad se nadje neki fajl.
Pozzzz!
Potpis
Ivan :)
pa to sam i uradio, i dobijam ja na kraju procesa kolliko ima fajlova, ali mi tada taj podatak ne znaci puno jer je postupak skeniranja cd-a vec gotov, a meni je potrebno da to znam pre nego sto pocne skeniranje, da bi mogao da odredim koliki je procenat fajlova skeniran
Kompliciras bezveze..
1) pogledas koliko je prostora zauzeto na disku
2) svaki put kada naidjes na file, dodaj velicinu fajla na brojac
procenat progresa ti je:
100 * brojac / zauzet prostor
2) svaki put kada naidjes na file, dodaj velicinu fajla na brojac
procenat progresa ti je:
100 * brojac / zauzet prostor
A kko da saznam velicinu diska?
GetDiskFreeSpace
Windows.Pas
Syntax
GetDiskFreeSpace(
lpRootPathName: PChar; {a pointer to the root path string}
var lpSectorsPerCluster: DWORD; {the number of sectors per cluster}
var lpBytesPerSector: DWORD; {the number of bytes per sector}
var lpNumberOfFreeClusters: DWORD; {the number of free clusters}
var lpTotalNumberOfClusters: DWORD {the total number of clusters on the drive}
): BOOL; {returns TRUE or FALSE}
Description
The GetDiskFreeSpace function retrieves information about a drive partition. It returns all the information needed to calculate the available free space for a drive. Note that under Windows 95 prior to service release 2, this function will return incorrect values for volumes bigger than 2 gigabytes in size.
Parameters
lpRootPathName: A null-terminated string containing the root directory of the drive to query.
lpSectorsPerCluster: A variable receiving the number of sectors per cluster for the specified drive. A sector is a collection of bytes, a cluster is a collection of sectors.
lpBytesPerSector: A variable receiving the number of bytes in each sector of the drive.
lpNumberOfFreeClusters: A variable receiving the number of free clusters on the drive. Drives are used in full cluster increments. Storing a file that is smaller then one cluster will allocate the entire cluster. To get the amount of free drive space in bytes, take the number of free clusters multiplied by the number of sectors per cluster, multiplied by the number of bytes per sector as in the following formula:
FreeClusters * SectorsPerCluster * BytesPerSector = Free space in bytes
lpTotalNumberOfClusters: A variable receiving the total number of clusters on the drive. To find the total size of the drive in bytes, take the total number of clusters multiplied by the number of sectors per cluster, multiplied by the number of bytes per sector, as in the following formula:
TotalNumberOfClusters * SectorsPerCluster * BytesPerSector = Size of drive in bytes
Return Value
If the function succeeds, it returns TRUE; otherwise it returns FALSE. To get extended error information, call the GetLastError function.
Example
Listing 14-5: Retrieving the Free Disk Space
procedure TForm1.Button1Click(Sender: Tobject);
var
SectorsPerCluster, // holds the sectors per cluster
BytesPerSector, // holds the bytes per sector
FreeClusters, // holds the number of free clusters
Clusters: DWORD; // holds the total number of disk clusters
begin
{retrieve the disk space information}
if GetDiskFreeSpace('C:\',SectorsPerCluster,BytesPerSector,
FreeClusters,Clusters) then
begin
{display the disk space information}
Panel2.Caption := IntToStr(SectorsPerCluster);
Panel3.Caption := IntToStr(BytesPerSector);
Panel4.Caption := IntToStr(FreeClusters);
Panel5.Caption := IntToStr(Clusters);
Panel6.Caption := IntToStr(FreeClusters*BytesPerSector*SectorsPerCluster);
Panel7.Caption := IntToStr(Clusters*BytesPerSector*SectorsPerCluster);
end;
end;
Snadji se! :)
Windows.Pas
Syntax
GetDiskFreeSpace(
lpRootPathName: PChar; {a pointer to the root path string}
var lpSectorsPerCluster: DWORD; {the number of sectors per cluster}
var lpBytesPerSector: DWORD; {the number of bytes per sector}
var lpNumberOfFreeClusters: DWORD; {the number of free clusters}
var lpTotalNumberOfClusters: DWORD {the total number of clusters on the drive}
): BOOL; {returns TRUE or FALSE}
Description
The GetDiskFreeSpace function retrieves information about a drive partition. It returns all the information needed to calculate the available free space for a drive. Note that under Windows 95 prior to service release 2, this function will return incorrect values for volumes bigger than 2 gigabytes in size.
Parameters
lpRootPathName: A null-terminated string containing the root directory of the drive to query.
lpSectorsPerCluster: A variable receiving the number of sectors per cluster for the specified drive. A sector is a collection of bytes, a cluster is a collection of sectors.
lpBytesPerSector: A variable receiving the number of bytes in each sector of the drive.
lpNumberOfFreeClusters: A variable receiving the number of free clusters on the drive. Drives are used in full cluster increments. Storing a file that is smaller then one cluster will allocate the entire cluster. To get the amount of free drive space in bytes, take the number of free clusters multiplied by the number of sectors per cluster, multiplied by the number of bytes per sector as in the following formula:
FreeClusters * SectorsPerCluster * BytesPerSector = Free space in bytes
lpTotalNumberOfClusters: A variable receiving the total number of clusters on the drive. To find the total size of the drive in bytes, take the total number of clusters multiplied by the number of sectors per cluster, multiplied by the number of bytes per sector, as in the following formula:
TotalNumberOfClusters * SectorsPerCluster * BytesPerSector = Size of drive in bytes
Return Value
If the function succeeds, it returns TRUE; otherwise it returns FALSE. To get extended error information, call the GetLastError function.
Example
Listing 14-5: Retrieving the Free Disk Space
procedure TForm1.Button1Click(Sender: Tobject);
var
SectorsPerCluster, // holds the sectors per cluster
BytesPerSector, // holds the bytes per sector
FreeClusters, // holds the number of free clusters
Clusters: DWORD; // holds the total number of disk clusters
begin
{retrieve the disk space information}
if GetDiskFreeSpace('C:\',SectorsPerCluster,BytesPerSector,
FreeClusters,Clusters) then
begin
{display the disk space information}
Panel2.Caption := IntToStr(SectorsPerCluster);
Panel3.Caption := IntToStr(BytesPerSector);
Panel4.Caption := IntToStr(FreeClusters);
Panel5.Caption := IntToStr(Clusters);
Panel6.Caption := IntToStr(FreeClusters*BytesPerSector*SectorsPerCluster);
Panel7.Caption := IntToStr(Clusters*BytesPerSector*SectorsPerCluster);
end;
end;
Snadji se! :)
Potpis
Ivan :)
Mislim da mu ne treba nista tako detaljno 
Dovoljno ce biti:
Gde je:
X = 0; trenutni disk
X = 1; Disk A
X = 2; Disk B
X = 3; Disk C
X = 4; Disk D
.
.
.
Ako ti treba slobodan prostor na disku koristi
X je isto kao i kod DiskSize.
P.S.
Ovo radi samo na Win platformama.
Dovoljno ce biti:
Code:
DiskSize(X);
DiskSize(X);
Gde je:
X = 0; trenutni disk
X = 1; Disk A
X = 2; Disk B
X = 3; Disk C
X = 4; Disk D
.
.
.
Ako ti treba slobodan prostor na disku koristi
Code:
DiskFree(X);
DiskFree(X);
X je isto kao i kod DiskSize.
P.S.
Ovo radi samo na Win platformama.
Potpis
Od viska glava ne boli! :)
Potpis
Ivan :)