Board index » delphi » Help trying to use GetVolumeInformation

Help trying to use GetVolumeInformation

I'm trying to get the volume label for a CD.
I had a look about the web for example of how to do this, and came up
with several examples using the GetVolumeInformation API call.
The trouble is, one of them was only half finished (it had variable
definitions missing), and another one which probably worked, but was
D1 and wouldn't work in D4.

I wish the help in Delphi had a pascal explaination of this call and
not just the C++ win32api definition. My knowledge of C++ and what
pascal variable means what C+= variable isn't good enough to work it
out myself!

Could someone give me an example or link to getting the drive info
from D3 or D4?

Thanks in advance,

Dodgy.

 

Re:Help trying to use GetVolumeInformation


Dodgy,

function TVolSerNr.GetNumber : string;
var
  Name  : PChar;
  Serie : PDWORD;
  X, Y  : Integer;
begin
  GetMem(Name, 256);
  GetMem(Serie, 1024);
  GetVolumeInformation( 'D:\'), Name, 256, Serie, X, Y, nil, 0);
  X := HiWord(Serie^);
  Y := LoWord(Serie^);
  Result := Format('%.4x - %.4x', [X, Y]);
  FreeMem(Serie, 1024);
  FreeMem(Name, 256);
end;

Success,
Alfred.

Dodgy heeft geschreven in bericht ...

Quote
>I'm trying to get the volume label for a CD.
>I had a look about the web for example of how to do this, and came up
>with several examples using the GetVolumeInformation API call.
>The trouble is, one of them was only half finished (it had variable
>definitions missing), and another one which probably worked, but was
>D1 and wouldn't work in D4.

>I wish the help in Delphi had a pascal explaination of this call and
>not just the C++ win32api definition. My knowledge of C++ and what
>pascal variable means what C+= variable isn't good enough to work it
>out myself!

>Could someone give me an example or link to getting the drive info
>from D3 or D4?

>Thanks in advance,

>Dodgy.

Re:Help trying to use GetVolumeInformation


Many thanks...

On Tue, 21 Sep 1999 02:20:51 +0200, "Alfred ten Hoeve"
<Alfred.tenHo...@gironet.nl> waffled on about something:

Quote
>Dodgy,

>function TVolSerNr.GetNumber : string;
>var
>  Name  : PChar;
>  Serie : PDWORD;
>  X, Y  : Integer;
>begin
>  GetMem(Name, 256);
>  GetMem(Serie, 1024);
>  GetVolumeInformation( 'D:\'), Name, 256, Serie, X, Y, nil, 0);
>  X := HiWord(Serie^);
>  Y := LoWord(Serie^);
>  Result := Format('%.4x - %.4x', [X, Y]);
>  FreeMem(Serie, 1024);
>  FreeMem(Name, 256);
>end;

>Success,
>Alfred.

>Dodgy heeft geschreven in bericht ...
>>I'm trying to get the volume label for a CD.
>>I had a look about the web for example of how to do this, and came up
>>with several examples using the GetVolumeInformation API call.
>>The trouble is, one of them was only half finished (it had variable
>>definitions missing), and another one which probably worked, but was
>>D1 and wouldn't work in D4.

>>I wish the help in Delphi had a pascal explaination of this call and
>>not just the C++ win32api definition. My knowledge of C++ and what
>>pascal variable means what C+= variable isn't good enough to work it
>>out myself!

>>Could someone give me an example or link to getting the drive info
>>from D3 or D4?

>>Thanks in advance,

>>Dodgy.

Other Threads