|
EI3.0每日清空文本变量小工具Delphi源码
不支持引擎清理ini变量 就写了一个简易的工具 ,复制源码 直接编译即可!
- program AutoClear;
- {$APPTYPE CONSOLE}
- uses
- SysUtils, Windows, Dialogs;
- const
- FileName = 'D:\MIR300\Envir\Variable\每日任务.ini';
- procedure ClearFileContents(const FileName: string);
- var
- FileHandle: THandle;
- begin
- FileHandle := CreateFile(PChar(FileName), GENERIC_WRITE, 0, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
- if FileHandle <> INVALID_HANDLE_VALUE then
- begin
- CloseHandle(FileHandle);
- Writeln('今日任务参数已重置.......');
- end
- else
- Writeln('无法打开文件:', FileName);
- end;
- procedure CheckTime;
- var
- CurrentTime: TSystemTime;
- ConsoleHandle: THandle;
- ConsoleWindowRect: TSmallRect;
- begin
- GetLocalTime(CurrentTime);
- if (CurrentTime.wHour = 0) and (CurrentTime.wMinute = 0) and (CurrentTime.wSecond = 0) then
- ClearFileContents(FileName);
- // 获取控制台窗口句柄
- ConsoleHandle := GetStdHandle(STD_OUTPUT_HANDLE);
- // 设置控制台窗口的尺寸和位置
- ConsoleWindowRect.Left := 0;
- ConsoleWindowRect.Top := 0;
- ConsoleWindowRect.Right := 29; // 设置窗口宽度
- ConsoleWindowRect.Bottom := 9; // 设置窗口高度
- SetConsoleWindowInfo(ConsoleHandle, True, ConsoleWindowRect);
- // 每秒检查一次时间
- Sleep(1000);
- CheckTime;
- end;
- begin
- try
- Writeln('----------------------------');
- Writeln('AutoClear正在运行,请勿关闭。');
- Writeln('----------------------------');
- // 检查时间并执行操作
- CheckTime;
- except
- on E: Exception do
- Writeln('发生错误:', E.ClassName, ' - ', E.Message);
- end;
- end.
复制代码
|
上一篇:Zircon传奇3内存优化源代码C#下一篇:Delphi传奇EI3.0客户端插件ClientEx.dll源码2.0
|