L
lixiaohui
Unregistered / Unconfirmed
GUEST, unregistred user!
type
PLongword = ^Longword;
PInteger = ^Integer;
PByte = ^Byte;
function BdSendMsg(phone,msg,OAddr:string):integer;
function SubmitAExEx(OrgTON:BYTE;OrgNPI:BYTE;OrgAddrchar;
DestTON:BYTE;DestNPI:BYTE;DestAddrchar;
PRI:BYTE;RD:BYTE;RP:BYTE;
SRR:BYTE;MR:BYTE;DCS:BYTE;
PID:BYTE;Schedulechar;Expirechar;
Default_ID:longword;UDHI:BYTE;UDLen:longword;
UserDatachar;ServiceSubTypechar;
byMsgIDByte;byPKTotal:BYTE;
byPKNumber:BYTE;byMsglevel:BYTE;
byFeeUserType:BYTE;sSPIDchar;sFeeTypechar;
sFeeAddrchar;sFeeCodechar;byUserNum:BYTE;
sDestAddrschar;SM_IDLongword;FCSBYTE
):integer;stdcall;external 'SMEIDll.dll' name 'SubmitAExEx';
function BdSendMsg(phone,msg,OAddr:string):integer;
var
iRet :integer;
OrgTON:BYTE;OrgNPI:BYTE;
OrgAddr:string;
DestTON:BYTE;DestNPI:BYTE;
DestAddr:string;
PRI:BYTE;RD:BYTE;RP:BYTE;
SRR:BYTE;MR:BYTE;DCS:BYTE;
PID:BYTE;
Default_ID:longword;
UDHI:BYTE;
UDLen:longword;
Schedule,Expire:string;
byMsgIDBYTE;
UserData,ServiceSubType:string;
byPKTotal:BYTE;
byPKNumber:BYTE;byMsglevel:BYTE;
byFeeUserType:BYTE;
byUserNum:BYTE;
sSPID,sFeeType,sFeeAddr,sFeeCode,sDestAddrs:string;
SM_ID:Longword;
FCS :Byte;
begin
try
OrgTON:=1; //源地址号码类型
OrgNPI:=1; //源地址编码方案
OrgAddr:=OAddr;
DestTON:=2; //目标地址号码类型
DestNPI:=1; //目标地址编码方案
DestAddr:='';
PRI:=0; //SM优先级
SRR:=1; //状态报告
DCS:=8; //数据编码方案
PID:=0;
default_id:=0; //缺省短消息的信息码,缺省为0。
UDHI:=0; //用于长短消息,表示UserData是否是结构
UserData:=msg;
UDLen:=length(msg); //用户信息,短消息正文
Schedule:='';
Expire:='';
ServiceSubType:='bdmc';
byPKTotal:=1; //相同Msg_id的消息总条数,从1开始
byPKNumber:=1; //相同Msg_id的消息序号,从1开始
byMsgLevel:=9; //信息级别,缺省为0。
byFeeUserType:=0; //计费用户类型字段:
sSPID:='403113';
sFeeType:='01';
sFeeCode:='000010';
byUserNum:=1; //接收消息的用户数量
sFeeAddr:='';
sDestAddrs:=phone;
GetMem(byMsgID,22);
ZeroMemory(byMsgID,22);
try
iRet:= SubmitAExEx(OrgTON,OrgNPI,pchar(OrgAddr),DestTON,DestNPI,pchar(DestAddr),PRI,0,0,
SRR,0,DCS,PID,pchar(Schedule),pchar(Expire),default_id,UDHI,UDLen,pchar(UserData),
pchar(ServiceSubType),byMsgID,byPKTotal,
byPKNumber,byMsgLevel,byFeeUserType,
pchar(sSPID),pchar(sFeeType),pchar(sFeeAddr),pchar(sFeeCode),
byUserNum,pchar(sDestAddrs),@SM_ID,@FCS);
//frmMain.memlog.Lines.Add('ACK应答消息的MsgID:'+inttostr(byMsgID^)+'短消息ID:'+inttostr(SM_ID^)+'SC端失败原因:'+inttostr(FCS^))
finally
if byMsgID<>nil then
FreeMem(byMsgID);
end;
result:=iRet;
except
on e:exception do begin
frmMain.memlog.Lines.Add('异常发现:'+e.Message);
result:=600; //自定义异常错误
raise;
exit;
end;
end;
end;
虽然可以正常发送短信,但偶尔捕获到异常:
Access violation at address 10027DD6 in module 'SMEIDll.dll'. Read of address 011B4000
请各位大侠赐教,是什么地方出了问题?
PLongword = ^Longword;
PInteger = ^Integer;
PByte = ^Byte;
function BdSendMsg(phone,msg,OAddr:string):integer;
function SubmitAExEx(OrgTON:BYTE;OrgNPI:BYTE;OrgAddrchar;
DestTON:BYTE;DestNPI:BYTE;DestAddrchar;
PRI:BYTE;RD:BYTE;RP:BYTE;
SRR:BYTE;MR:BYTE;DCS:BYTE;
PID:BYTE;Schedulechar;Expirechar;
Default_ID:longword;UDHI:BYTE;UDLen:longword;
UserDatachar;ServiceSubTypechar;
byMsgIDByte;byPKTotal:BYTE;
byPKNumber:BYTE;byMsglevel:BYTE;
byFeeUserType:BYTE;sSPIDchar;sFeeTypechar;
sFeeAddrchar;sFeeCodechar;byUserNum:BYTE;
sDestAddrschar;SM_IDLongword;FCSBYTE
):integer;stdcall;external 'SMEIDll.dll' name 'SubmitAExEx';
function BdSendMsg(phone,msg,OAddr:string):integer;
var
iRet :integer;
OrgTON:BYTE;OrgNPI:BYTE;
OrgAddr:string;
DestTON:BYTE;DestNPI:BYTE;
DestAddr:string;
PRI:BYTE;RD:BYTE;RP:BYTE;
SRR:BYTE;MR:BYTE;DCS:BYTE;
PID:BYTE;
Default_ID:longword;
UDHI:BYTE;
UDLen:longword;
Schedule,Expire:string;
byMsgIDBYTE;
UserData,ServiceSubType:string;
byPKTotal:BYTE;
byPKNumber:BYTE;byMsglevel:BYTE;
byFeeUserType:BYTE;
byUserNum:BYTE;
sSPID,sFeeType,sFeeAddr,sFeeCode,sDestAddrs:string;
SM_ID:Longword;
FCS :Byte;
begin
try
OrgTON:=1; //源地址号码类型
OrgNPI:=1; //源地址编码方案
OrgAddr:=OAddr;
DestTON:=2; //目标地址号码类型
DestNPI:=1; //目标地址编码方案
DestAddr:='';
PRI:=0; //SM优先级
SRR:=1; //状态报告
DCS:=8; //数据编码方案
PID:=0;
default_id:=0; //缺省短消息的信息码,缺省为0。
UDHI:=0; //用于长短消息,表示UserData是否是结构
UserData:=msg;
UDLen:=length(msg); //用户信息,短消息正文
Schedule:='';
Expire:='';
ServiceSubType:='bdmc';
byPKTotal:=1; //相同Msg_id的消息总条数,从1开始
byPKNumber:=1; //相同Msg_id的消息序号,从1开始
byMsgLevel:=9; //信息级别,缺省为0。
byFeeUserType:=0; //计费用户类型字段:
sSPID:='403113';
sFeeType:='01';
sFeeCode:='000010';
byUserNum:=1; //接收消息的用户数量
sFeeAddr:='';
sDestAddrs:=phone;
GetMem(byMsgID,22);
ZeroMemory(byMsgID,22);
try
iRet:= SubmitAExEx(OrgTON,OrgNPI,pchar(OrgAddr),DestTON,DestNPI,pchar(DestAddr),PRI,0,0,
SRR,0,DCS,PID,pchar(Schedule),pchar(Expire),default_id,UDHI,UDLen,pchar(UserData),
pchar(ServiceSubType),byMsgID,byPKTotal,
byPKNumber,byMsgLevel,byFeeUserType,
pchar(sSPID),pchar(sFeeType),pchar(sFeeAddr),pchar(sFeeCode),
byUserNum,pchar(sDestAddrs),@SM_ID,@FCS);
//frmMain.memlog.Lines.Add('ACK应答消息的MsgID:'+inttostr(byMsgID^)+'短消息ID:'+inttostr(SM_ID^)+'SC端失败原因:'+inttostr(FCS^))
finally
if byMsgID<>nil then
FreeMem(byMsgID);
end;
result:=iRet;
except
on e:exception do begin
frmMain.memlog.Lines.Add('异常发现:'+e.Message);
result:=600; //自定义异常错误
raise;
exit;
end;
end;
end;
虽然可以正常发送短信,但偶尔捕获到异常:
Access violation at address 10027DD6 in module 'SMEIDll.dll'. Read of address 011B4000
请各位大侠赐教,是什么地方出了问题?