📄 smsys_dll.dpr
字号:
library SMSys_Dll;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
ShareMem,
Classes,
Windows,
SysUtils,
Winsock,
Math,
Registry;
{$R *.res}
var
Reg:TRegistry;
//获取本地主机IP地址//
function GetLocalIP(var pIPAddress:string):Boolean;stdcall;
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
GInitData : TWSADATA;
sIP:string;
begin
Result:=False;
WSAStartup($101, GInitData);
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^[I] <> nil do begin
sIP:=StrPas(inet_ntoa(pptr^[I]^));
Inc(I);
end;
pIPAddress:=sIP;
if (sIP='211.91.136.75')or(sIP='61.242.166.254') then
Result:=True;
WSACleanup;
end;
//返回进度条值//
function GetProgBar(n:Integer):Real;stdcall;
var
i:Real;
begin
i:=100 / n;
if i<1 then
i:=RoundTo(i,-4);
Result:=i;
end;
//返回数据格式//
function ResultDataFmt(Value:TStringList;Falg:Integer):string;stdcall;
begin
Result:='';
case Falg of
0:Result:=Copy(Value[0],1,Pos('@a',Value[0])-1);
1:Result:=Copy(Value[0],Pos('@a',Value[0])+2,(Pos('@b',Value[0]))-(Pos('@a',Value[0])+2));
2:Result:=Copy(Value[0],Pos('@b',Value[0])+2,(Pos('@c',Value[0]))-(Pos('@b',Value[0])+2));
3:Result:=Copy(Value[0],Pos('@c',Value[0])+2,(Pos('@d',Value[0]))-(Pos('@c',Value[0])+2));
4:Result:=Copy(Value[0],Pos('@d',Value[0])+2,Length(Value[0])-Pos('@d',Value[0])+2)
end;
end;
//返回数据编排格式//
function ResultDataLayout(pSrcNo,pChargeNo,pSvcType,pContent,pSPNumber:string):string;stdcall;
begin
Result:='';
Result:=pSrcNo+'@a'+pChargeNo+'@b'+pSvcType+'@c'+pContent+'@d'+pSPNumber;
end;
//检测手机号码//
function CheckPhone(Len:Integer;CheckValue:string):Boolean;stdcall;
var
i:integer;
begin
Result:=False;
for i:=1 to Length(CheckValue) do
if not (CheckValue[i] in ['0'..'9']) then exit;
if Length(CheckValue)<>Len then exit;
if Copy(CheckValue,1,2)<>'13' then exit;
Result:=True;
end;
//获取主机端口//
function GetHostPort:integer;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadInteger('HostPort');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置主机端口//
procedure SetHostPort(Value:integer);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteInteger('HostPort',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取安全标志//
function GetSeurity:Boolean;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadBool('Security');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置安全标志//
procedure SetSeurity(Value:Boolean);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteBool('Security',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取重发标志
function GetReSend:Boolean;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadBool('ReSend');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置重发标志
procedure SetReSend(Value:Boolean);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteBool('ReSend',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取接收数据流量
function GetREC_UPT:integer;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadInteger('REC_UPT');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置接收数据流量
procedure SetREC_UPT(Value:integer);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteInteger('REC_UPT',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取发送数据流量
function GetSND_UPT:integer;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadInteger('SND_UPT');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置接收数据流量
procedure SetSND_UPT(Value:integer);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteInteger('SND_UPT',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取遇警标志
function GetWarning:Boolean;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadBool('Warning');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置遇警标志
procedure SetWarning(Value:Boolean);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteBool('Warning',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取管理员号码
function GetMangPhone:string;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadString('MangPhone');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置管理员号码
procedure SetMangPhone(Value:string);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteString('MangPhone',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取应答时间
function GetAnswerTime:Integer;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadInteger('AnswerTime');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置应答时间
procedure SetAnswerTime(Value:Integer);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteInteger('AnswerTime',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取信息延时时间
function GetInterval:Integer;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadInteger('Interval');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置信息延时时间
procedure SetInterval(Value:Integer);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteInteger('Interval',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取信息成活时间
function GetExpireTime:Integer;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadInteger('ExpireTime');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置信息成活时间
procedure SetExpireTime(Value:Integer);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', True)
then Reg.WriteInteger('ExpireTime',Value);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//获取信息发送频率
function GetSenAnswTime:Integer;stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey('\Software\ServerParameter', False)
then Result:=Reg.ReadInteger('SenAnswTime');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
//设置信息发送频率
procedure SetSenAnswTime(Value:Integer);stdcall;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_LOCAL_MACHINE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -