Delphi 创建目录及写日志文件
Delphi 创建目录及写日志文件
var
TF: TextFile;
LogFile: string;
txt :string;
sysDir:string;
//创建按钮
procedure TForm1.Button1Click(Sender: TObject);
begin
sysDir:=extractfilepath(application.ExeName );
if not directoryexists(sysdir+'log\') then
createdir(sysdir+'log\');
logfile:=sysdir+'log\'+formatdatetime('yyyymmdd',now)+'.txt';
end;
//写日志按钮
procedure TForm1.Button2Click(Sender: TObject);
begin
//assignfile(logfile,'log.txt');
AssignFile(tf,logfile);
if fileexists(logfile) then
append(tf)
else
rewrite(tf);
writeln(tf,'123');
closefile(tf);
end;
相关文档:
dll 调用方法有 静态调用和动态调用两种方法
用到的dll为上篇文章所编写的dll.
总结如下:
Unit Unit1;
Interface
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
Type
TForm1 = Class(TForm)
Button1: TButton; ......
delphi 注册 com 对象的方法
procedure TForm1.Button3Click(Sender: TObject);
var
Sd: TSecurityDescriptor;
begin
InitializeSecurityDescriptor(@Sd, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(@Sd, true, Nil, false);
RegSe ......
1、TStringList支持的最大行数是多少?(http://topic.csdn.net/t/20060209/14/4547405.html)
楼主结论:“TStringList的LoadfromFile函数应该只能读取15万行以内的数据,但TStringList和TList的Add函数可以加到几百万行(甚至更多)也不会出错。程序出错的原因应该是Add非法内存指针导致的,正如tanlim(求学者) &nb ......
Delphi 7之后的版本,增加了运算符的重载。虽然不尽人意(需要写特定英文),但有总比没有强。
例:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
T3DPoint = record
X, Y, Z: Doub ......