unit Unit3;
interface
uses
Winapi.Windows, System.SysUtils, System.Classes,
Vcl.Controls,
Vcl.Forms, HiPathProCenterScreenPopAPILibrary_TLB;
type
// musste ich jetzt selbst anlegen, gab es nur den dispinterface-Typen für???
IScreenPopTelephoneListenerEvents =
interface
['
{65CA62A4-921C-48B4-A4AA-20739C0F8EDA}']
function ScreenPop(
const ScreenPopTelephoneEvent: IScreenPopTelephoneEvent): HResult;
safecall;
function StatusChanged(newStatus: enListenerStatus): HResult;
safecall;
end;
TForm3 =
class(TForm, IScreenPopTelephoneListenerEvents)
private
procedure StartInBackground;
public
function ScreenPop(
const ScreenPopTelephoneEvent: IScreenPopTelephoneEvent): HRESULT;
safecall;
function StatusChanged(newStatus: enListenerStatus): HResult;
safecall;
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
{ TForm3 }
procedure TForm3.StartInBackground;
var
Listener: ScreenPopTelephoneListener;
Events: _IScreenPopTelephoneListenerEvents;
ScreenPopEvent: IScreenPopTelephoneEvent;
begin
Listener := CoScreenPopTelephoneListener.Create;
Listener.Initialize('
6000@XXX');
Listener.StartListening('
000');
// Unklar, Doku fehlt! Wahrscheinlich eher nicht so gemeint!
if Supports(Listener, _IScreenPopTelephoneListenerEvents, Events)
then
begin
ScreenPopEvent := CoScreenPopTelephoneEvent.Create;
Events.ScreenPop(ScreenPopEvent)
end
else
begin
// Eher der logischere Weg. Du implementierst das IScreenPopTelephoneListenerEvents selbst und
// meldest es am Listener an, aber dafür fehlt eine Add- oder Register-Funktion in der importierten TLB-Unit.
// Siehe auch die Konstanten SCREENPOP_CanNot_Register und SCREENPOP_Already_Registered
// Also so zum Beispiel:
Listener.AddEventListener(Self);
oder
Listener.RegisterEvents(Self);
end;
end;
function TForm3.ScreenPop(
const ScreenPopTelephoneEvent: IScreenPopTelephoneEvent): HRESULT;
begin
OutputDebugString(PChar(ScreenPopTelephoneEvent.From));
OutputDebugString(PChar(ScreenPopTelephoneEvent.Destination));
OutputDebugString(PChar(ScreenPopTelephoneEvent.QueueName));
Result := S_OK;
end;
function TForm3.StatusChanged(newStatus: enListenerStatus): HResult;
begin
end;
end.