一、project -> import tye library -> add->c:\winnt\system32\scrrun.dll(win98是system) ->install
二、在工程中引用Scripting_TLB.pas,利用里面的ifilesystem,可能进行各种与文件系统有关的操作。
二、在工程中引用Scripting_TLB.pas,利用里面的ifilesystem,可能进行各种与文件系统有关的操作。
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
var
d: Char;
s: String;
begin
for d:='A' to 'Z' do
begin
s := d + ': ';
case GetDriveType(PChar(d + ':.')) of
// 0: s := s + 'The drive type cannot be determined.';
// 1: s := s + 'The root directory does not exist.';
DRIVE_REMOVABLE: s := s + 'The drive can be removed from the drive.';
DRIVE_FIXED: s := s + 'The disk cannot be removed from the drive.';
DRIVE_REMOTE: s := s + 'The drive is a remote (network) drive.';
DRIVE_CDROM: s := s + 'The drive is a CD-ROM drive.';
DRIVE_RAMDISK: s := s + 'The drive is a RAM disk.';
else
// s := s + 'Unknown!!!!!!';
end;
if Length(s)>3 then
Memo1.Lines.Add(s);
end;
end;end.
LPTSTR lpBuffer // 缓冲首址
);
ParametersnBufferLengthSpecifies the maximum size, in characters, of the buffer pointed to by lpBuffer. This size does not include the terminating null character. lpBufferPoints to a buffer that receives a series of null-terminated strings, one for each valid drive in the system, that end with a second null character. The following example shows the buffer contents with <null> representing the terminating null character. c:\<null>d:\<null><null>
用这个API试试,分析返回的串:
a:\0 b:\ c:\0 d:\0
其中0是内码0