📄 main.pas
字号:
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
iAutoCADVision: Integer;
implementation
uses ShellAPI, Registry, IniFiles, RegExpr;
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Close;
end;
procedure TForm1.FormShow(Sender: TObject);
var
reg: TRegistry;
sExeParam: string;
sPath: string; //AcadLocation
iniFile: TIniFile;
sExePath: string;
scr: TStrings;
sDDLName: string;
i: Integer;
sDLLNameList: TStrings;
regr: TRegExpr;
sCaption:string;
begin
sExePath := ExtractFilePath(Application.ExeName);
iniFile := TIniFile.Create(sExePath + 'config.ini');
if iAutoCADVision = 2008 then
begin
sCaption := iniFile.ReadString('Application','AutoCADTitle2008','新达专用屏风统计系统 AutoCAD');
Self.Caption := sCaption;
iniFile.WriteInteger('Application','AutoCADVision',2008);
sPath := iniFile.ReadString('Application', 'AcadLocation2008', 'D:\Program Files\AutoCAD 2008');
sDDLName := iniFile.ReadString('Application', 'DLLName', 'Quote.dll');
if (sPath = '') or (not FileExists(sPath + '\ACAD.exe')) then
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('SOFTWARE\Autodesk\AutoCAD\R17.1\ACAD-6001:804', False);
sPath := reg.ReadString('AcadLocation');
reg.Free;
iniFile.WriteString('Application', 'AcadLocation2008', sPath);
end;
if not FileExists(sPath + '\ACAD.exe') then
begin
Application.MessageBox(PChar('找不到AutoCAD 2008路径,请手动在config.ini文件添加。' + #13#10 +
'将路径添加到AcadLocation2008项,' + #13#10 +
'如 AcadLocation2008 = D:\Program Files\AutoCAD 2008'), PChar('提示'), MB_OK);
Exit;
end;
end
else
begin
sCaption := iniFile.ReadString('Application','AutoCADTitle2007','新达专用屏风统计系统 AutoCAD 2007');
Self.Caption := sCaption;
iniFile.WriteInteger('Application','AutoCADVision',2007);
sPath := iniFile.ReadString('Application', 'AcadLocation2007', 'D:\Program Files\AutoCAD 2007');
sDDLName := iniFile.ReadString('Application', 'DLLName', 'Quote.dll');
if (sPath = '') or (not FileExists(sPath + '\ACAD.exe')) then
begin
reg := TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('SOFTWARE\Autodesk\AutoCAD\R17.0\ACAD-5001:804', False);
sPath := reg.ReadString('AcadLocation');
reg.Free;
iniFile.WriteString('Application', 'AcadLocation2007', sPath);
end;
if not FileExists(sPath + '\ACAD.exe') then
begin
Application.MessageBox(PChar('找不到AutoCAD 2007路径,请手动在config.ini文件添加。' + #13#10 +
'将路径添加到AcadLocation2007项,' + #13#10 +
'如 AcadLocation2007 = D:\Program Files\AutoCAD 2007'), PChar('提示'), MB_OK);
Exit;
end;
end;
if not iniFile.ValueExists('Application', 'DLLName') then
begin
iniFile.WriteString('Application', 'DLLName', sDDLName);
end;
iniFile.Free;
sDLLNameList := TStringList.Create;
regr := TRegExpr.Create;
regr.Expression := ';';
regr.Split(sDDLName, sDLLNameList);
scr := TStringList.Create;
for i := 0 to sDLLNameList.Count - 1 do
begin
scr.Add('netload "' + sExePath + sDLLNameList[i] + '"');
end;
scr.SaveToFile(sExePath + 'start.scr');
scr.Free;
reg.Free;
sDLLNameList.Free;
sExeParam := '"' + sPath + '\ACAD.exe" /p Quote /nologo ' +
'/b "' + sExePath + 'start.scr' + '"';
WinExec(PChar(sExeParam), SW_SHOWNORMAL);
Timer1.Enabled := True;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -