怎么将这段cb的代码转成delphi的,请帮个忙,我不懂CB(100分)

  • 主题发起人 jiachenghuang
  • 开始时间
J

jiachenghuang

Unregistered / Unconfirmed
GUEST, unregistred user!
void __fastcall TServerImpl::OnHistory(WORD NodeID,LPSAFEARRAY HistoryEvents,
VARIANT_BOOL* Proccessed)
{

static const BYTE EventClass[]=
{0,0,0,0,0,0,0,0,/*-*/3,3,3,3,3,3,0,0, //00--0f
3,3,3,3,3,3,0,0,/*-*/0,0,0,0,0,0,0,0, //10--1f
2,2,4,2,2,2,2,2,/*-*/2,0,2,3,0,0,0,0, //20--2f
2,2,4,2,2,2,2,2,/*-*/2,0,2,0,0,0,0,0, //30--3f
3,3,3,0,0,0,0,0,/*-*/0,0,0,0,0,0,0,0, //40--4f
1,1,0,0,0,0,0,0,/*-*/0,0,0,0,0,0,0,0, //50--5f
0,0,0,0,0,0,0,0,/*-*/0,0,0,0,0,0,0,0, //60--6f
0,0,0,0,0,0,0,0,/*-*/0,0,0,0,0,0,0,0, //70--7f
1,1,1,1,1,1,0,0,/*-*/1,1,1,1,1,1,0,0, //80--8f
0,1,1,1,1,1,0,0,/*-*/0,0,0,0,0,0,0,0, //90--9f
2,2,4,2,2,2,2,2,/*-*/2,0,2,0,0,0,0,0, //a0--af
2,2,4,2,2,2,2,2,/*-*/2,0,2,0,0,0,0,0, //b0--bf
1,0,1,0,0,0,0,1,/*-*/1,1,0,0,0,0,0,0, //c0--cf
0,0,1,1,0,0,0,0,/*-*/0,0,0,0,0,0,0,0, //d0--df
0,0,0,0,0,0,0,0,/*-*/0,0,0,0,0,0,0,0, //e0--ef
1,1,0,0,0,0,0,0,/*-*/0,0,0,0,0,0,0,0};
//f0--ff
int iCount=HistoryEvents->rgsabound[0].cElements;
tagHistoryEvent *phes=(tagHistoryEvent*)HistoryEvents->pvData;
BOOL bSuccessed=TRUE;
int iContents;
long Flags=0;
try{
for(int i=0;i<iCount;i++){
//TParameters * pParas=pCmd->Parameters;
TParameters * pParas=pStoreProc->Parameters;
pParas->ParamByName(WideString("@MessageID"))->Value=phes.EventID;
pParas->ParamByName(WideString("@CardID"))->Value=phes.CardNo;
pParas->ParamByName(WideString("@CardZoneID"))->Value=phes.CardZone;
pParas->ParamByName(WideString("@PointAddress"/*"Address"*/))->Value=phes.PointAddress;
pParas->ParamByName(WideString("@EventTime"))->Value=phes.EventTime;
pParas->ParamByName(WideString("@controlMachineAddress"))->Value=phes.CtrlAddress;
pParas->ParamByName(WideString("@SubPointIP"))->Value=*(NodeNames[NodeID]);
iContents=EventClass[phes.EventID];
pParas->ParamByName(WideString("@Contents"))->Value=iContents;
Flags |=1 << (iContents-1);
//pCmd->Execute();
pStoreProc->ExecProc();
}
}catch(...){ bSuccessed=FALSE;}
if(!bSuccessed) return;
Fire_HistoryEvent(Flags);
*Proccessed=True;
}
 
高手帮帮呀,急死了 :(
 
没人呢,哎
 
译好就结贴,谢谢了
 
顶部