网站建议:179001057@qq.com

Delphi 文件、目录等常用操作函数 - delphi - gliethttp

技术2022-05-12  1

[ http://blog.chinaunix.net/u1/38994/showart_303315.html ] Delphi 文件、目录等常用操作函数 - delphi - gliethttp< /BR> ... Delphi 文件、目录等常用操作函数

1.获取exe程序的相对路径(不含"/")

ShowMessage(ExtractFileDir(Application.Exename));//如: D:/gliethttp

2.获取exe程序的相对路径(含"/") ShowMessage(ExtractFilePath(Application.Exename));//如: D:/gliethttp/

3.打开指定文件:首先,uses ShellAPI;然后,调用如下函数

ShellExecute(handle,'open','c:/gliethttp.c',nil,nil,sw_shownormal);

或 ShellExecute(handle,'open','c:/gliethttp.exe',nil,nil,sw_shownormal); 4.Memo常用消息

滚到底:SendMessage(Memo1.Handle,EM_LINESCROLL,0,Memo1.Lines.Count);

获取当前最顶行的行号:Result:=SendMessage(Memo1.Handle,EM_GETFIRSTVISIBLELINE,0,0);

获取当前矩形下容纳的行数:FontHeight:Integer; ARect:TRect; begin FontHeight:=abs(Memo1.Font.Height); SendMessage(Memo1.Handle,EM_GETRECT,0,DWord(@ARect)); Result:=(ARect.Bottom-ARect.Top) div FontHeight;

...

最新回复(0)