我想在combobox的下拉框中有计算机的所有硬盘分区,并且当我选择分区时,在listbox中显示该分区中的目录,如何实现呀?如果能给出源代码,不胜感激
解决方案 »
- delphi中操作cookie,为什么我写不对呀
- ODBC数据源问题
- 要回家过年了,高兴散分!
- 我的程序需要调用很多图片,但我不想用LoadFromFile等直接读文件,怎么办?
- 怎么样把xml格式的数据读到access数据库中
- 请教用delphi的Tquery控件处理oracle数据库的问题
- 小妹问badcopy算法
- 如何截获从网络上传给本地一个应用程序的数据包?
- 请成功使用JBuilder5的朋友指教!!
- 变量循环赋值
- 一个比较复杂的问题,如何比较图象的不同。
- corba问题,为什么会出现"Class not found:Files\borland\vbroker\jre\bin\jre.exe"
var
x:integer;
drive:char;
y:integer;
begin
x:=0;
y:=0;
x:=GetLogicalDrives();
repeat
x:= x div 2 ;
Y:=Y+1;
until x=1;
x:=0;
for drive:='a' to 'z' do
begin
Case GetDriveType(pchar(Drive+':\')) of
2: Label1.Caption :='软盘驱动器';
3: Label1.Caption := '硬盘驱动器';
4: Label1.Caption := '网络驱动器';
5: Label1.Caption := 'CD-ROM驱动器';
6: Label1.Caption := '虚拟驱动器';
Else Label1.Caption := '驱动器无效';
end;
if GetDriveType(pchar(Drive+':\'))in[2,3,4,5,6] then
ComboBox1.Items.Add(pchar(drive+':\ ')+label1.Caption);
x:=x+1;
if x>y then begin
showmessage('Done !');
exit;
end;
end;
end;procedure TForm1.ComboBox1Change(Sender: TObject);var
SearchRec:TSearchRec;
ext,AppPath:string;
begin
listbox1.Items.Clear;
AppPath:=copy(combobox1.Items.Strings[combobox1.itemindex],1,3);
ext:='*.*';
FindFirst(AppPath+ext,faDirectory,SearchRec);
listbox1.Items.Add(SearchRec.Name);
while FindNext(SearchRec)=0 do
listbox1.Items.Add(SearchRec.Name);
end;
TShellTreeView
TShellListView