📄 dll.pas
字号:
unit dll;
interface
uses
Windows, Forms, SysUtils, Classes;
type
TDeliver = Record
RecvType:byte;
SrcNo: array [0..21] of byte;
TpUid:byte;
TpUdhi:byte;
Encoded:byte;
MsgLength:Word;
Msg: array [0..160] of byte;
end;
type
TResult = Record
RecvType:byte;
Oid:Integer;
CurrTimes:Integer;
SendTime:array [0..14] of byte;
SendMode: array [0..8] of byte;
DestNo: array [0..21] of byte;
State:byte;
ChargeNo: array [0..21] of byte;
Reserve: array [0..110] of byte;
end;
type
TReceive = record
Case rec:byte of
1:(st_Deliver: TDeliver);
2:(st_Result: TResult);
end;
//============================================================================//
function SendSMS(P_DestNo:string; //被叫手机号码,C字符串,最长21字节
p_SvcType:string; //服务类型,C字符串,最长10字节
p_Length:Integer; //发送内容长度,无符号整形,4字节
p_Content:string; //发送的内容,字符型,长度为p_Length
p_TpPid:byte; //通常为0,仅用于向非NOKIA手机发送铃声和图片
p_TpUdhi:byte; //通常为0,仅用于向非NOKIA手机发送铃声和图片
p_ScheduleTime:string; //发送时间,C字符串,长度为14,格式为YYYYMMDDhhmmss,空串表示立即发送
p_ExpireTime:Word; //有效时间(分钟),无符号短整型,2字节,0为使用短信中心缺省值
p_Times:Word; //发送次数,无符号短整型,2字节,0无效
p_Interval:Word; //每次发送的间隔时间(分钟),无符号短整型,2字节,0无效
p_ChargeNo:string):Integer;cdecl;external 'xboxdll.dll';
//付费号码,C字符串,最长21字节;如为NULL或空串("\0")表示由被叫付费;如为"0"表示由SP付费
//stdcall;external cdecl\
function SendBatchSMS(P_DestNo:array of Char; //被叫手机号码,C字符串,最长21字节
p_SvcType:array of Char; //服务类型,C字符串,最长10字节
p_Length:word; //发送内容长度,无符号整形,4字节
p_Content:array of Char; //发送的内容,字符型,长度为p_Length
p_ScheduleTime:array of Char; //发送时间,C字符串,长度为14,格式为YYYYMMDDhhmmss,空串表示立即发送
p_ExpireTime:word; //有效时间(分钟),无符号短整型,2字节,0为使用短信中心缺省值
p_Times:word; //发送次数,无符号短整型,2字节,0无效
p_Interval:word; //每次发送的间隔时间(分钟),无符号短整型,2字节,0无效
p_ChargeNo:array of Char; //付费号码,C字符串,最长21字节;如为NULL或空串("\0")表示由被叫付费;如为"0"表示由SP付费
p_Oid:word):integer;cdecl;external 'xboxdll.dll';
//无符号整型数组,元素个数等于被叫号码的个数,用于存放返回的OID
function RecvMsg(p_MaxRecv:byte;p_Buffer:array of Char):Integer; //最多接收DELIVER和RESULT的条数,1字节
cdecl;external 'xboxdll.dll';//存放返回结果的缓冲区
//============================================================================//
procedure CurLogMsg(Falg:integer;Msg:string);
procedure ErrorMsg(Falg:Integer;ErrMsg:PChar);
procedure _st_bar(var x:Integer);
procedure _st_changing;
function CheckPhone(Len:Integer;CheckValue:string):Boolean;
implementation
uses SM_SP_Server;
var
MsgReceive : LongWord=0;
MsgRightNum : LongWord=0;
ErrRecord : LongWord=0;
WaitCommandRun: Byte;
BufferRecord : Byte;
CommandRunNum : Byte;
procedure _st_changing;
begin
with frm_smServer.st_bar.Canvas do
begin
FillRect(Rect(242,3,360,22));
frm_smServer.ImageList1.Draw(frm_smServer.st_bar.Canvas,v_Rect.Left+4,v_Rect.Top+2,RI);
if RI=1 then
TextOut(v_Rect.Left+22,v_Rect.Top+4,'正在连机工作...') else
TextOut(v_Rect.Left+22,v_Rect.Top+4,'正在脱机工作...');
end;
end;
procedure _st_bar(var x:Integer);
begin
case x of
0:frm_smServer.st_bar.Panels[1].Text:='数据库出错!';
-1:frm_smServer.st_bar.Panels[1].Text:='读xboxp.ini文件出错!';
-2:frm_smServer.st_bar.Panels[1].Text:='函数参数不符!';
-3:frm_smServer.st_bar.Panels[1].Text:='Socket版本不符!';
-4:begin
frm_smServer.st_bar.Panels[1].Text:='连接服务器失败!';
RI:=0;
end;
-5:frm_smServer.st_bar.Panels[1].Text:='接受服务器端数据出错!';
-100:frm_smServer.st_bar.Panels[1].Text:='分配内存空间失败!';
end;
end;
function CheckPhone(Len:Integer;CheckValue:string):Boolean;
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;
procedure CurLogMsg(Falg:integer;Msg:string);
begin
Case Falg of
0: begin
if frm_smServer.m_Rec_Win.Lines.Count<=100 then
frm_smServer.m_Rec_Win.Lines.Add(Msg) else
begin
frm_smServer.m_Rec_Win.Lines.Add(Msg);
frm_smServer.m_Rec_Win.Lines.Delete(0);
end;
frm_smServer.m_Rec_Win.Lines.Add('');
end;
end;
end;
procedure ErrorMsg(Falg:Integer;ErrMsg:PChar);
begin
Case Falg of
0: Raise Exception.Create(ErrMsg);
1:MessageBox(Application.handle,ErrMsg,PChar('注意'),MB_ICONINFORMATION);
2:MessageBox(Application.handle,ErrMsg,PChar('错误'),MB_ICONSTOP);
3:MessageBox(Application.handle,ErrMsg,PChar('错误'),MB_OK);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -