0 Comments

Delphi基础开发技巧(9)

发布于:2014-04-23  |   作者:广州网站建设  |   已聚集:人围观
[DELPHI]目录完全删除(deltree)
procedure TForm1.DeleteDirectory(strDir:String); 
var 
sr: TSearchRec; 
FileAttrs: Integer; 
strfilename:string; 
strPth:string; 
begin 
strpth:=Getcurrentdir(); 
FileAttrs := faAnyFile; 
if FindFirst(strpth+'\'+strdir+'\*.*', FileAttrs, sr) = 0 then 
begin 
if (sr.Attr and FileAttrs) = sr.Attr then 
begin 
strfilename:=sr.Name; 
if fileexists(strpth+'\'+strdir+'\'+strfilename) then 
deletefile(strpth+'\'+strdir+'\'+strfilename); 
end; 
while FindNext(sr) = 0 do 
begin 
if (sr.Attr and FileAttrs) = sr.Attr then 
begin 
strfilename:=sr.name; 
if fileexists(strpth+'\'+strdir+'\'+strfilename) then 
deletefile(strpth+'\'+strdir+'\'+strfilename); 
end; 
end; 
FindClose(sr); 
removedir(strpth+'\'+strdir); 
end; 
end;

广州网站建设,广州网站设计,广州网站制作,网站建设,网站设计,广州网站建设公司,广州网站设计公司,品牌网站建设

[DELPHI]取得TMemo 控件当前光标的行和列信息到Tpoint中 
1.function ReadCursorPos(SourceMemo: TMemo): TPoint; 
var Point: TPoint; 
begin 
  point.y := SendMessage(SourceMemo.Handle,EM_LINEFROMCHAR,SourceMemo.SelStart,0); 
  point.x := SourceMemo.SelStart-SendMessage(SourceMemo.Handle,EM_LINEINDEX,point.y,0); 
  Result := Point;
end; 
2.LineLength:=SendMessage(memol.handle,EM-LINELENGTH,Cpos,0);//行长

标签:
飞机