Getting disc size


I try to obtain available and total disc space. I use NeroCDInfo.ncdiFreeCapacityInBlocks and NeroCDInfo.ncdiTotalCapacity (Delphi API).

Now, for CDs, FreeCapacityInBlocks multiplied with 2040 gives correct capacity. But, for DVD (DVD+RW) it always returns the same number (2295104 blocks, no matter how much data is on DVD).

On the other hand, TotalCapacity returns a strange number. 2,19Gb for DVD and 351,41Mb for CD (it seems given number is in kilobytes? - well, I multiply it with 1024 and then I send it to custom function that returns size in Gb/Mb from bytes)

How to get correct numbers?

Also, does anyone else having problems with Delphi API? UserDlg callback never gets called back :-).
Any ideas?

There is a ntiBlockSize field in a NERO_TRACK_INFO structure. You should use that when calculating the size of that particular track. Other than that, data blocks are 2048 bytes in general so your calucation is a bit faulty. Not sure if this is supported by Delphi API.

Ok, thanks. Number 2040 I got manually. I was quite close then :-))).

But what is the number that ncdiTotalCapacity returns? Also, why I always get the same number of blocks when reading DVD? No matter if disc is empty or filled with data, number of blocks is always the same.

It is a known issue with DVD-/+RW. You can have more details in another thread in this forum (middle of May 2004).