procedure getAllDisk(var DiskList:TStringList);
function IsNT: Boolean ;
var
OSVersionInfo: TOSVersionInfo;
begin
OSVersionInfo.dwOSVersionInfoSize := SizeOf(OSVersionInfo);
GetVersionEx(OSVersionInfo);
if OSVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT then
Result := True
else
Result := False;
end;
var
i:byte;
j:integer;
drv
Char;
AChar:array[1..3] of char;
begin
if isNT then
begin
For i:=1 to 26 do
begin
AChar[1]:=Chr(64+i);
AChar[2]:=':';
AChar[3]:=#0;
drv:=@AChar;
J:=GetDriveType(drv);
if J=DRIVE_REMOVABLE then
DiskList.Add(Chr(64+i)+'
软盘)');
if J=DRIVE_FIXED then
if DiskSize(i)<>-1 then DiskList.Add(Chr(64+i)+'
硬盘'
+IntToStr(DiskSize(i) div 1024 div 1024)+'M/剩'
+IntToStr(DiskFree(i) div 1024 div 1024)+'M)');
if J=DRIVE_REMOTE then
DiskList.Add(Chr(64+i)+'
网络映射)');
if J=DRIVE_CDROM then
DiskList.Add(Chr(64+i)+'
光盘)');
if J=DRIVE_RAMDISK then
DiskList.Add(Chr(64+i)+'
虚拟盘)');
end;
end;
if not isNT then
begin
For i:=1 to 26 do
begin
AChar[1]:=Chr(64+i);
AChar[2]:=':';
AChar[3]:=#0;
drv:=@AChar;
J:=GetDriveType(drv);
if J=DRIVE_REMOVABLE then
DiskList.Add(Chr(64+i)+'
软盘)');
if ((J=DRIVE_FIXED) or (i=3)) then
if DiskSize(i)<>-1 then DiskList.Add(Chr(64+i)+'
硬盘'
+IntToStr(DiskSize(i) div 1024 div 1024)+'M/剩'
+IntToStr(DiskFree(i) div 1024 div 1024)+'M)');
if J=DRIVE_REMOTE then
DiskList.Add(Chr(64+i)+'
网络映射)');
if J=DRIVE_CDROM then
DiskList.Add(Chr(64+i)+'
光盘)');
if J=DRIVE_RAMDISK then
DiskList.Add(Chr(64+i)+'
虚拟盘)');
end;
end;
end;
这是我择取一段程序的源码,返回的tstringlist,你作为流发送到本地,再从本地上显示出来应该很简单吧,如果不会,你说一声,你告诉我你的网络编程环境,我给你写一个。