R
robinswp
Unregistered / Unconfirmed
GUEST, unregistred user!
看如下程序:
procedure TFmMain.N12Click(Sender: TObject);
begin
PreTabSheet := PageConTrol1.ActivePage;
TSACDSTatusEnter(Sender);
PageConTrol1.ActivePage := TSACDStatus;
end;
procedure TFmMain.TSACDStatusEnter(Sender: TObject);
var
ACDNum,i:Integer;
DesSize:Word;
PACDIDArray:^ACDIDArray;
PACDInfoDBCCC_ACD_INFO;//PDBCCC_ACD_INFO := ^TDBCCC_ACD_INFO(结构体);
PDeschar;
Num:integer;
begin
GetMem(PACDInfo,SizeOf(TDBCCC_ACD_INFO));
DesSize := 10;
CBACDStatusQue.Items.Clear;
WRet:=CcPhone.QueryACDID;
if WRet <> CCS_OK then
begin
Application.MessageBox('查询呼叫队列ID失败','确认',MB_OK);
exit;
end;
if WRet = CCS_OK then
begin
ACDNum:=CcPhone.ACDNumber;
SetLength(ArrayACDID,ACDNum);
// Try
GetMem(PACDIDArray,ACDNum*Sizeof(Word));
Move(CcPhone.Total_ACDID^,PACDIDArray^,ACDNum*Sizeof(Word))
// New(Pdes);
for i := 0 to ACDNum-1 do
begin
ArrayACDID := PACDIDArray^;
New(Pdes);
WRet := CcPhone.QueryACDSkill(ArrayACDID,pDes,DesSize);
if WRet <> CCS_OK then
begin
Application.MessageBox('查询呼叫队列技能失败','确认',MB_OK);
exit;
end;
//ReallocMem(PDes,DesSize+1);
CBACDStatusQue.Items.Add(StrPas(PDes));
Dispose (pDes);
end;
CBACDStatusQue.ItemIndex := 0;
// finally
FreeMem(PACDIDArray,ACDNum);
// Dispose (pDes);
// end;
// Try
Num := sizeof(TDBCCC_ACD_INFO);
// ????????????
// New(PACDInfo);
WRet := CcPhone.QueryACDStatus(ArrayACDID[0],PACDInfo);
if WRet <> CCS_OK then
begin
Application.MessageBox('查询呼叫队列状态失败','确认',MB_OK);
exit;
end;
EdtACDStatusQueSize.Text := IntToStr(PACDInfo.usQueueSize);
EdtACDStatusQueTime.Text := IntToStr(PACDInfo.ulQueueTime);
EdtACDStatusWaitTime.Text := IntToStr(PACDInfo.ulEstWaitTime);
EdtACDStatusLoginAgents.Text := IntToStr(PACDInfo.usLoggedOnAgents);
EdtACDStatusAvailAgents.Text := IntToStr(PACDInfo.usAvailAgents);
// finally
FreeMem(PACDInfo);
// Dispose (pDes);
// FreeMem(PACDIDArray);
// end;
end;
在TSACDSTatusEnter(Sender)退出时报程序非法操作;
如把GetMem(PACDInfo,SizeOf(TDBCCC_ACD_INFO))放在//??????????处则执行
GetMem(PACDInfo,SizeOf(TDBCCC_ACD_INFO))时出错.
procedure TFmMain.N12Click(Sender: TObject);
begin
PreTabSheet := PageConTrol1.ActivePage;
TSACDSTatusEnter(Sender);
PageConTrol1.ActivePage := TSACDStatus;
end;
procedure TFmMain.TSACDStatusEnter(Sender: TObject);
var
ACDNum,i:Integer;
DesSize:Word;
PACDIDArray:^ACDIDArray;
PACDInfoDBCCC_ACD_INFO;//PDBCCC_ACD_INFO := ^TDBCCC_ACD_INFO(结构体);
PDeschar;
Num:integer;
begin
GetMem(PACDInfo,SizeOf(TDBCCC_ACD_INFO));
DesSize := 10;
CBACDStatusQue.Items.Clear;
WRet:=CcPhone.QueryACDID;
if WRet <> CCS_OK then
begin
Application.MessageBox('查询呼叫队列ID失败','确认',MB_OK);
exit;
end;
if WRet = CCS_OK then
begin
ACDNum:=CcPhone.ACDNumber;
SetLength(ArrayACDID,ACDNum);
// Try
GetMem(PACDIDArray,ACDNum*Sizeof(Word));
Move(CcPhone.Total_ACDID^,PACDIDArray^,ACDNum*Sizeof(Word))
// New(Pdes);
for i := 0 to ACDNum-1 do
begin
ArrayACDID := PACDIDArray^;
New(Pdes);
WRet := CcPhone.QueryACDSkill(ArrayACDID,pDes,DesSize);
if WRet <> CCS_OK then
begin
Application.MessageBox('查询呼叫队列技能失败','确认',MB_OK);
exit;
end;
//ReallocMem(PDes,DesSize+1);
CBACDStatusQue.Items.Add(StrPas(PDes));
Dispose (pDes);
end;
CBACDStatusQue.ItemIndex := 0;
// finally
FreeMem(PACDIDArray,ACDNum);
// Dispose (pDes);
// end;
// Try
Num := sizeof(TDBCCC_ACD_INFO);
// ????????????
// New(PACDInfo);
WRet := CcPhone.QueryACDStatus(ArrayACDID[0],PACDInfo);
if WRet <> CCS_OK then
begin
Application.MessageBox('查询呼叫队列状态失败','确认',MB_OK);
exit;
end;
EdtACDStatusQueSize.Text := IntToStr(PACDInfo.usQueueSize);
EdtACDStatusQueTime.Text := IntToStr(PACDInfo.ulQueueTime);
EdtACDStatusWaitTime.Text := IntToStr(PACDInfo.ulEstWaitTime);
EdtACDStatusLoginAgents.Text := IntToStr(PACDInfo.usLoggedOnAgents);
EdtACDStatusAvailAgents.Text := IntToStr(PACDInfo.usAvailAgents);
// finally
FreeMem(PACDInfo);
// Dispose (pDes);
// FreeMem(PACDIDArray);
// end;
end;
在TSACDSTatusEnter(Sender)退出时报程序非法操作;
如把GetMem(PACDInfo,SizeOf(TDBCCC_ACD_INFO))放在//??????????处则执行
GetMem(PACDInfo,SizeOf(TDBCCC_ACD_INFO))时出错.