Delphi ÁгöĿ¼ÏµÄÎļþ
function ListFiles(Dir: String):TStrings;
var
FSearchRec: TSearchRec;
FileList: TStrings;
FindResult: Integer;
begin
if Dir[length(Dir)]<>'\' then Dir:=Dir+'\';
FileList :=TStringList.Create;
FindResult:=FindFirst(Dir+'*.*,faAnyFile+faDirectory,FSearchRec);
while FindResult = 0 do
begin
if ((FSearchRec.Attr and faDirectory) = 0) then //Îļþ
begin
FileList.Add('Îļþ:'+LowerCase(Dir+FSearchRec.Name));
end;
if ((FSearchRec.Attr and faDirectory) <> 0) then
begin
if ((FSearchRec.Name<> '.') and (FSearchRec.Name <> '..')) then //Îļþ¼Ð
begin
ListFiles(dir+FileRec.Name);
end;
end;
FindResult:=FindNext(FSearchRec);
end;
FindClose(FSearchRec);
ListFiles:=FileList;
end;
Ïà¹ØÎĵµ£º
delphiµ÷ÓÃÑ¡ÔñĿ¼¶Ô»°¿ò
¾³£¼ûÍøÉÏÓÐÈËÎÊÑ¡ÔñĿ¼¶Ô»°¿òµÄ¿Ø¼þ£¬ÆäʵֻÓÃÒ»¸öº¯Êý¾Í¿ÉÒÔʵÏÖ¡£
×¢ÒâÒýÓÃ Filectrl µ¥Ôª
use Filectrl;
procedure TForm1.Button1Click(Sender: TObject);
var
Dir: String;
begin
SelectDirectory('Select a directory', '', Dir);
ShowMessage(Dir);
end; ......
1>ÏòÖ¸¶¨µÄÇøÓò»òÐÎ×´Ìí¼Ó³¬Á´½Ó¡£
Óï·¨
±í´ïʽ.Add(Anchor, Address, SubAddress, ScreenTip, TextToDisplay)
±í´ïʽ Ò»¸ö´ú±í Hyperlinks ¶ÔÏóµÄ±äÁ¿¡£
²ÎÊý
Ãû³Æ±ØÑ¡/¿ÉÑ¡Êý¾ÝÀàÐÍÃèÊö
Anchor
±ØÑ¡
Object
³¬Á´½ÓµÄλÖ᣿ÉΪ Range »ò Shape ¶ÔÏó¡£
Address
±ØÑ¡
String
³¬Á´½ÓµÄµØÖ ......
var
ExcelFile:string;
SourceRange,DesRange:Variant;
Row,Column,i:integer;
begin
if OpenDialog1.Execute then
begin
ExcelFile:=OpenDialog1.Files[0];
if not FileExists(ExcelFile) then Exit;
end
else
Exit;
try
ExcelApp:=CreateOleObject('Excel.Application');
......
Delphi ÖÐÈçºÎ°²×°×é¼þ?
delphiÖÐÈçºÎ°²×°×é¼þÓÐÎåÖÖÇé¿ö£º
1¡¢Ö»ÓÐÒ»¸öDCUÎļþµÄ×é¼þ¡£DCUÎļþÊDZàÒëºÃµÄµ¥ÔªÎļþ£¬ÕâÑùµÄ×é¼þÊÇ×÷Õß²»Ïë°ÑÔ´Â빫²¼¡£Ò»°ãÀ´Ëµ£¬×÷Õß±ØÐë˵Ã÷´Ë×é¼þÊʺÏDelphiµÄÄÄÖÖ°æ±¾£¬Èç¹û°æ±¾²»¶Ô£¬ÔÚ°²×°Ê±¾Í»á³öÏÖ´íÎó¡£Ò²ÕýÊÇÒòΪûÓÐÔ´Â룬¸øʹÓÃÕß´øÀ´Á˲»±ã£¬ÄǾÍÊÇÒ»µ©Delphi°æ±¾Éý¼¶£¬´Ë× ......