全部博文(2005)
分类:
2007-05-17 15:11:25
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;