?? smg_recvthread.pas
字號:
unit SMG_RecvThread;
interface
uses
Classes, SysUtils, SP_SMG_DLL, Windows, ActiveX, ShellApi, DLL_Exports;
type
Recv_Thread = class(TThread)
private
DeliverBuf: DeliverStr;
procedure RecvBuffer;
{ Private declarations }
protected
procedure Execute; override;
public
constructor Create(FDeliver: DeliverStr; CreateSuspended: Boolean);
end;
implementation
{ Important: Methods and properties of objects in VCL or CLX can only be used
in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure Recv_Thread.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ Recv_Thread }
uses SPServer, SMG_DB;
procedure Recv_Thread.Execute;
begin
{ Place thread code here }
FreeOnTerminate := True;
RecvBuffer;
end;
constructor Recv_Thread.Create(FDeliver: DeliverStr; CreateSuspended: Boolean);
begin
DeliverBuf := FDeliver;
FreeOnTerminate := True;
inherited Create(CreateSuspended);
end;
procedure Recv_Thread.RecvBuffer;
var
cTemp:Char;
Dest:PChar;
MsgArray: array of Char;
pReport:ReportStr;
Z,I,Len,pLen:Integer;
SckHandle:LongInt;
pSPNum,pSrcNo,pTp_Pid,pTp_Udhi,pMsgContent,pMsgCoding:string;
pSeqNum1,pSeqNum2,pSeqNum3:LongInt;
begin
Dec(RI);
FillChar(pReport,SizeOf(pReport),' ');
with frmSGIP do
begin
with DeliverBuf do
begin
pSeqNum1:=SeqNum1;
pSeqNum2:=SeqNum2;
pSeqNum3:=SeqNum3;
pSPNum:=SPNum;
pSrcNo:=SrcNo;
pTp_Pid:=Tp_Pid;
pTp_Udhi:=Tp_Udhi;
CurLogMsg(TRE,'序列號1:'+IntToStr(SeqNum1));
CurLogMsg(TRE,'序列號2:'+IntToStr(SeqNum2));
CurLogMsg(TRE,'序列號3:'+IntToStr(SeqNum3));
CurLogMsg(TRE,'手機號:'+SrcNo);
CurLogmsg(TRE,'SP號碼:'+SPNum);
CurLogmsg(TRE,'Tp_Pid:'+pTp_Pid);
CurLogmsg(TRE,'Tp_Udhi:'+pTp_Udhi);
CurLogmsg(TRE,'信息長度:'+IntToStr(MsgLen));
if MsgCoding=#0 then
begin
CurLogMsg(TRE,'信息內(nèi)容:'+MsgContent);
CurLogMsg(TRE,'信息編碼:'+'0');
end;
if (MsgCoding=#15)or(MsgCoding=#8) then
begin
if MsgCoding=#15 then CurLogMsg(TRE,'信息編碼:15');
if MsgCoding=#8 then CurLogMsg(TRE,'信息編碼:8');
Len := MsgLen;
for I:=0 to MsgLen-1 do
pMsgContent:=pMsgContent+IntToHex(Ord(MsgContent[I]),2);
pMsgContent:=UnicodeToStr(pMsgContent);
CurLogMsg(TRE,'信息內(nèi)容:'+pMsgContent);
SckHandle:=0;
if SearchSckHandle(pSPNum,SckHandle) > 0 then
SendBuffer(SckHandle,DeliverBuf,pReport,101);
with frmSMGDB.tblDeliver do
begin
Open;
Insert;
Fields[1].Value:=pSeqNum1;
Fields[2].Value:=pSeqNum2;
Fields[3].Value:=pSeqNum3;
Fields[4].Value:=pSrcNo;
Fields[5].Value:=pSPNum;
Fields[6].Value:=pTp_pid;
Fields[7].Value:=pTp_udhi;
Fields[8].Value:=pMsgCoding;
Fields[9].Value:=pLen;
Fields[10].Value:=pMsgContent;
Post;
end;
end;
end;
end;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -