From: "Bjørge Sæther" Subject: Re: Getr volume label in Delphi 3 Date: 19 Apr 1999 00:00:00 GMT Message-ID: References: <371a4672.2503370@news.xs4all.nl> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: news-abuse@online.no X-Trace: news1.online.no 924474150 130.67.76.235 (Mon, 19 Apr 1999 00:22:30 MET DST) Organization: Telenor Online Public Access NNTP-Posting-Date: Mon, 19 Apr 1999 00:22:30 MET DST Newsgroups: alt.comp.lang.borland-delphi Hi ! I found this in the FileCtrl.Pas file (not globally available), it should do it: Bjoerge ... function VolumeID(DriveChar: Char): string; var OldErrorMode: Integer; NotUsed, VolFlags: DWORD; Buf: array [0..MAX_PATH] of Char; begin OldErrorMode := SetErrorMode(SEM_FAILCRITICALERRORS); try Buf[0] := #$00; if GetVolumeInformation(PChar(DriveChar + ':\'), Buf, DWORD(sizeof(Buf)), nil, NotUsed, VolFlags, nil, 0) then SetString(Result, Buf, StrLen(Buf)) else Result := ''; if DriveChar < 'a' then Result := AnsiUpperCaseFileName(Result) else Result := AnsiLowerCaseFileName(Result); Result := Format('[%s]',[Result]); finally SetErrorMode(OldErrorMode); end; end; -- Bjørge Sæther REMOVETHIS_bsaether@online.no J.R. Ferguson skrev i meldingen <371a4672.2503370@news.xs4all.nl>... >I have tried unsuccessfully to get the volume label of a disk in >Delphi 3 on a Windows 95 system, using FAT32 and long filenames. Can >anyone tell me how to do this? >I have tried: >a) FindFirst('C:\*.*',faVolumeId,SRec); doesn't find the label. >b) Windows.GetVolumeInformation(...); Can't get the parameters right. >Can anyone help me out with an example? > >Gratefully, >Bob Ferguson. > > >-- >J.R. Ferguson, Amsterdam, The Netherlands >e-mail: j.r.ferguson@iname.com >web: www.xs4all.nl/~ferguson >Freeware for DOS and Windows