На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
! user posted image
Пожалуйста, выделяйте текст программы тегом [сode=pas] ... [/сode]. Для этого используйте кнопку [code=pas] в форме ответа или комбобокс, если нужно вставить код на языке, отличном от Дельфи/Паскаля.

Соблюдайте общие правила форума

Следующие вопросы задаются очень часто, подробно разобраны в FAQ и, поэтому, будут безжалостно удаляться:
1. Преобразовать переменную типа String в тип PChar (PAnsiChar)
2. Как "свернуть" программу в трей.
3. Как "скрыться" от Ctrl + Alt + Del (заблокировать их и т.п.)
4. Как запустить программу/файл? (и дождаться ее завершения)
5. Как перехватить API-функции, поставить hook? (перехват сообщений от мыши, клавиатуры - внедрение в удаленное адресное прстранство)
... (продолжение следует) ...

Внимание:
Попытки открытия обсуждений реализации вредоносного ПО, включая различные интерпретации спам-ботов, наказывается предупреждением на 30 дней.
Повторная попытка - 60 дней. Последующие попытки - бан.
Мат в разделе - бан на три месяца...

Полезные ссылки:
user posted image MSDN Library user posted image FAQ раздела user posted image Поиск по разделу user posted image Как правильно задавать вопросы


Выразить свое отношение к модераторам раздела можно здесь: user posted image Rouse_, user posted image Krid

Модераторы: Rouse_, Krid
  
> infra call center
    Уважаемые профи,помогите пожалуйста разобраться в чём ошибка?
    суть приложения в том что оно цепляется к проге Infra call center,которая ловит звонки пользователей,и записывает в файл номер телефона...
    Но у меня выскакивает ошибка...
    Выкладываю весь код проги...
    ExpandedWrap disabled
      unit Unit1;
       
      interface
       
      uses
        Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
        Dialogs, StdCtrls, DB, DBClient, MConnect, SConnect, ComCtrls, ADODB,ComObj,
        Inifiles,ToolWin, ActnMan, ActnCtrls, ActnMenus,InfraCallCenterClientFacade2_TLB
        ,INFRACSREMOTEPROXYLib2_TLB,ActiveX, OleCtrls,Mask;
       
      type
       
        TForm1 = class(TForm)
          Edit1: TEdit;
          Edit2: TEdit;
          Label1: TLabel;
          Label2: TLabel;
          Button1: TButton;
       
          procedure Button1Click(Sender: TObject);
          
        private
          { Private declarations }
        public
          { Public declarations }
          FICC:ICallCenter;
          FIAG:IAgent;
          FIFS:IAgentSession;
          connectionManager, connection: OleVariant;
          clientFacade: IUnknown;
          agentSession:IAgentSession;
          phoneSession:IAgentPhoneSession;
          IAPS:IAgentPhoneSessionEvents ;
        end;
       
      var
        Form1: TForm1;
       
      implementation
      {$R *.dfm}
       
      //-------------------------------------------------------------
      //процедура записи в файл
      procedure fileCreate(fName,str: String);
      var fileT: TextFile;
       
      begin
       
      DeleteFile(fName);
        AssignFile(fileT,fName);
        {$I-}
        Append(fileT);
        if IOResult<>0 then
        begin
          {$I-}
          Rewrite(fileT);
          {$I+}
          if IOResult<>0 then
          begin
            ShowMessage('Ошибка создания файла ' + fName);
            Exit;
          end;
        end;
        WriteLn(fileT,str);
        CloseFile(fileT);
      end;
       
      //-----------------------------------------------------------------------------
      //процедура определения номера
      procedure writeNum(pSession: IAgentPhoneSession);
      var
      phoneCall: OleVariant;
      phoneCalls:IPhoneCallCollection;
      num,i: Integer;
      ini:TIniFile;
      nOut,nLog,a,str: String;
      begin
      ini:=TiniFile.Create('...file.ini');
      nout:=Ini.ReadString('FILES','out',a);
      nlog:=Ini.ReadString('FILES','log',a);
        try
        psession.QueryInterface(IPhoneCallCollection,phoneCalls);
        except
        exit;
        end;
      if (assigned(phoneCalls)) then
      begin
        for i:=0 to phoneCalls.Count  do
        begin
          phoneCall:=phoneCalls.Item[i];
          num:=phoneCall.ConnectedNumber;
          showmessage(inttostr(num));
          if ((num<>null)and(length(intToStr(num))>0))  then
          begin
            str:=intToStr(num);
            phoneCall:=null;
          end;
        end;
      end;
      if (str <> null) and (length(str)>2) then
      begin
        fileCreate(nout,str);
        str:= DateToStr(Date) + ' ' + TimeToStr(Date) + ' ' + str;
        fileCreate(nlog,str);
        str:=null;
      end;
      end;
      //----------------------------------------------------------------------------
      procedure TForm1.Button1Click(Sender: TObject);
      var
        username,password,csConnectionRegPath:String;
        phoneCalls:IPhoneCallCollection;
      begin
      username := Edit1.Text;
      password := Edit2.Text;
      csConnectionRegPath := 'Software\Infra Telesystems\Infra Communications Suite\2.30\CallCenterClientConnection';
      edit1.Enabled:=false;
      edit2.Enabled:=false;
       
        connectionManager := CreateOleObject('INFra.ICSFacadeConnector.ConnectionManager');
      try
        connection:=connectionManager.OpenConnection('192.168.1.80', username, 'INFRAPBX120', password);
      except
        ShowMessage('Неправильно указаны логин и/или пароль');
        Exit;
      end;
        clientFacade:=connection.GetFacade('{85DF82AA-0961-4C7B-B5B8-2541DB635DC0}',0 );
        clientFacade.QueryInterface(ICallCenter, FICC);
        FIAG := FICC.Agent as IAgent;
        phoneSession:=FIAG.PhoneSession as IAgentPhoneSession;
        ShowMessage('1');
        if (not assigned(phoneSession) or not phoneSession.Opened) then
        begin
        ShowMessage('2');
          FIAG.OpenPhoneSession('',PhoneSessionType_Handset,'');
          ShowMessage('3');
          phoneSession:=FIAG.PhoneSession as IAgentPhoneSession;
          ShowMessage('4');
        end;
      while (true)  do
        begin
          if (phoneSession.PhoneState<>PhoneState_Idle)  //вот здесь ошибка
          then
               writeNum(phoneSession);
          end;
      end;
        
      end.

    да, ошибка OLE error C0000096 или access violation..
    это как я понял значит что объект ссылается на пустое место в памяти...но почему оно пустое?!ведь сессия создана и открыта
    1 пользователей читают эту тему (1 гостей и 0 скрытых пользователей)
    0 пользователей:


    Рейтинг@Mail.ru
    [ Script execution time: 0,0689 ]   [ 15 queries used ]   [ Generated: 23.05.24, 01:57 GMT ]