电脑爱好者,提供IT资讯信息及各类编程知识文章介绍,欢迎大家来本站学习电脑知识。 最近更新 | 联系我们 RSS订阅本站最新文章
电脑爱好者
站内搜索: 
当前位置:首页>> delphi技术>>Delphi基础开发技巧(9):

Delphi基础开发技巧(9)

来源:远方网络 | 2005-12-31 9:28:45 | (有1940人读过)

[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);//行长



delphi技术热门文章排行
网站赞助商
购买此位置

 

关于我们 | 网站地图 | 文档一览 | 友情链接| 联系我们

Copyright © 2003-2024 电脑爱好者 版权所有 备案号:鲁ICP备09059398号