 |
Anthony's VBA Forum Where the knowledge is shared |
|
|
View previous topic :: View next topic |
Author |
Message |
bit of byte
Joined: 16 Jan 2005 Posts: 1
|
Posted: Sun Jan 16, 2005 8:12 pm Post subject: RECOGNISE CD VOLUME LABEL - VB CODE |
|
|
Hello all you nerds!
I have code in C++ I wish to convert to VB.
Basically, I wish to recognise the CD volume label using VB..
Can anyone please provide the equivalent VB code using the C++ code given below?
public
{ Public declarations}
function GetCDLetter: string;
function GetCDLabel(Drive: string): string;
end;
var
Form1: Tform1;
Implementation
{SR *.DFM}
procedure Tform1.Button1Click(Sender: TObject);
begin
Label1.Caption:=GetCDLabel(GetCDLetter());
end;
function TForm1.GetCDLetter: string;
var
N: Byte;
Drv: string;
Drives: set of 0..25;
begin
Integer(Drives):=GetLogicalDrives;
For N:=0 to 25 do
If N in Drives then
begin
Drives:=Char(N+Ord(‘A’))+’:\’;
If(GetDriveType(Pchar(Drv))=5) then
begin
Result:=Drv;
Exit;
end;
end;
end;
function Tform1.GetCDLabel(Drive: string): string;
var
VolumeName: array[0..255] of Char;
FileSystemType: array[0..255] of Char;
SerialNum: DWORD;
MaxFilenameLength: DWORD;
Flage: DWORD;
Begin
If (GetVolumeInformation(Pchar(Drive),VolumeName,256,@SerialNum,MaxFilenameLength,Flags,FileSystemType,256)) then Result: =VolumeName
Else Result:=’No CD Present’;
end; |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|