📄 rsglcommon.pas
字号:
unit RsglCommon;
interface
uses
Windows, SysUtils, Forms, DB, DBGrids, Classes, ADODB;
resourcestring
conSplashFile = 'splash.jpg';
conRSGLDataFile = 'RSGL.mdb';
const
CNT_ConnectString =
'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source= %s;' +
'Mode=Share Deny None;Extended Properties="";' +
'Persist Security Info=False;Jet OLEDB:System database="";' +
'Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";' +
'Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;' +
'Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;' +
'Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;' +
'Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don''t Copy Locale on Compact=False;' +
'Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False';
type
TOperateType = (optAdd, optEdit, optBrowse);
TVerType = (vtFile, vtProduct, vtBuild);
var
EXEPath: string; //主程序路径
DataPath: string; //数据路径
systemPath: string; //系统路径
UserName: string; //当前用户名称
function GetExePath: string;
procedure InitCombo(Astrings: TStrings; ATable: TAdoTable; AFieldname: string);
function GetVersion(AFileName: string; AVerType: TVerType = vtFile): string;
implementation
function GetExePath: string;
begin
Result := ExtractFilePath(ParamStr(0));
end;
procedure InitCombo(Astrings: TStrings; ATable: TAdoTable; AFieldname: string);
begin
Astrings.Clear;
with ATable do
try
if not Active then Open;
First;
while not eof do
begin
Astrings.Add(FieldByName(AFieldname).AsString);
Next;
end;
finally
Close;
end;
end;
function GetVersion(AFileName: string; AVerType: TVerType): string;
var
InfoSize, Wnd: DWORD;
VerBuf: Pointer;
FI: PVSFixedFileInfo;
VerSize: DWORD;
begin
Result := '';
InfoSize := GetFileVersionInfoSize(PChar(AFileName), Wnd);
if InfoSize <> 0 then
begin
GetMem(VerBuf, InfoSize);
try
if GetFileVersionInfo(PChar(AFileName), Wnd, InfoSize, VerBuf) then
if VerQueryValue(VerBuf, '\', Pointer(FI), VerSize) then
case AVerType of
vtFile:
Result := Format('%d.%d.%d.%d', [HIWORD(FI.dwFileVersionMS),
LOWORD(FI.dwFileVersionMS), HIWORD(FI.dwFileVersionLS),
LOWORD(FI.dwFileVersionLS)]);
vtProduct:
Result := Format('%d.%d', [HIWORD(FI.dwProductVersionMS),
LOWORD(FI.dwProductVersionMS)]);
vtBuild:
Result := Format('%d', [LOWORD(FI.dwFileVersionLS)]);
end;
finally
FreeMem(VerBuf);
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -