下面struct这个恐怖吧:用sizeof取得有2888长,我只不过想玩玩一下,全部
写成pascal的,可能要几个钟头。
typedef struct ctcEventData
{
unsigned long refId;
unsigned long oldRefId;
unsigned long secOldRefId;
ctcGlobalRefId globalRefId;
unsigned long netCallId;
unsigned long oldNetCallId;
unsigned long state;
unsigned long event;
unsigned long eventQualifier;
unsigned long associatedEvent;
unsigned long type;
unsigned long callsQueued;
unsigned long otherPartyType;
unsigned long otherPartyQualifier;
unsigned long otherPartyDialingPlan;
ctcDeviceString otherParty;
unsigned long otherPartyTrunk;
unsigned long otherPartyGroup;
unsigned long thirdPartyType;
unsigned long thirdPartyQualifier;
unsigned long thirdPartyDialingPlan;
ctcDeviceString thirdParty;
unsigned long thirdPartyTrunk;
unsigned long thirdPartyGroup;
unsigned long calledPartyType;
unsigned long calledPartyQualifier;
unsigned long calledPartyDialingPlan;
ctcDeviceString calledParty;
unsigned long calledPartyTrunk;
unsigned long calledPartyGroup;
unsigned long originatingPartyType;
unsigned long originatingPartyQualifier;
unsigned long originatingPartyDialingPlan;
ctcDeviceString originatingParty;
unsigned long originatingPartyTrunk;
unsigned long originatingPartyGroup;
unsigned long monitorPartyType;
ctcDeviceString monitorParty;
ctcDeviceString nestedMonitorChannel;
unsigned long agentMode;
ctcDeviceString agentId;
ctcDeviceString agentGroup;
ctcDeviceString agentData;
ctcDeviceString logicalAgent;
ctcDeviceString dtmfDigits;
ctcApplString applicationData;
ctcAccountInfo accountInfo;
ctcTimeStamp timeStamp;
unsigned long privateData;
unsigned long deviceFeatureId;
unsigned long deviceFeatureIndicator;
ctcDeviceString deviceFeatureData1;
ctcDeviceString deviceFeatureData2;
ctcPartyInfo partyInfo[ 6 ];
unsigned long countConferencedParties;
} ctcEventData;
这下好了,delphi中我用一个数组代替就可以了!
ctcEventData = ^_ctcEventData;
data: array[0..2887] of Byte;
end;
里面的内容可以用以下方法写在文件中,日后分析!
.....
procedure TctcAppFrm.Button7Click(Sender: TObject);
var r, monitorMode: LongWord;
size1: Integer;
eventData: _ctcEventData;
begin
r := ctcGetMonitor(channel, monitorMode);
Memo1.Lines.Add('取监控状态!返回码=' + inttostr(r) + ',' + ctcErrMsg(r));
Memo1.Lines.Add('monitorMode=' + inttostr(monitorMode));
if (monitorMode = ctck_on) then begin
r := ctcGetEvent(channel, @eventData, 0);
Memo1.Lines.Add('取事件内容!返回码=' + inttostr(r) + ',' + ctcErrMsg(r));
if r = 1 then begin
with TMemoryStream.Create do begin
Size1 := SizeOf(eventData);
Write(eventData, Size1);
SaveToFile('c:/data.txt');
end;
end;
end;
end;