a***@aol.com
2012-01-31 16:30:21 UTC
I am attempting to utilize a HID device which provides a DLL which
includes a type library which I import into Delphi via Project |
Import Type Library. This imported _TLB.pas includes the definition of
an event interface for the device.
I have previously done a similar task similarly importing a type
library and then using Binh Ly’s (of Tech Vanguards) Event Implementor
to end up providing Delphi events which work fine. The _TLB provides
an inteface declaration for the device event. And AFAICS Binh Ly’s
code provides a Delphi class for the event interface and connects via
a Connection Point, which it finds by means of an event GUID placed in
the Registry by the device installer (I may be a bit hazy here because
I am presuming outside my real knowledge<g>).
The device I am now attempting to utilize has a method named Advise in
its main device interface which has a parameter for the event
interface. This IDeviceNotification (here I quote from the
documentation) “provides the status of notification from the device.
It is prepared on the client side and passes this interface to the
Advise method of the “ device “interface. The IdeviceNotification
interface is a callback interface implemented with a client
application in otder to be notified from the Device Manager of device
connections & disconnections”.
AFAICS I must provide an instance of the IDeviceNotification to
receive the events & so call the Delphi events.
But as the device notification instance must be passed to the device
in the Advise method it appears to me that there is no connection
point available to use Binh Ly’s code, and I must write separate Code
and generate class entries in the Registry which reference my
implementation class in a dll so that I can generate an instance with
a call to CreateComObject.
OR can I implement the interface in a normal Delphi class implementing
the interface, and call that class’s “Create as IDeviceNotification”
and pass the returned reference in the Advise method, without having
to make my additional registry entries.
AFAICS Binh Ly’s code does not make a specific separate instance of
the interface but implements Delphi code which connects via the
connection point. Perhaps my new device does not have a connection
point and the Advise method is its external way of implementing what
Binh Ly does.
As you can see I have no real knowledge of interfaces and am
struggling. Any helpful comments will be gratefully received.
Alan Lloyd
includes a type library which I import into Delphi via Project |
Import Type Library. This imported _TLB.pas includes the definition of
an event interface for the device.
I have previously done a similar task similarly importing a type
library and then using Binh Ly’s (of Tech Vanguards) Event Implementor
to end up providing Delphi events which work fine. The _TLB provides
an inteface declaration for the device event. And AFAICS Binh Ly’s
code provides a Delphi class for the event interface and connects via
a Connection Point, which it finds by means of an event GUID placed in
the Registry by the device installer (I may be a bit hazy here because
I am presuming outside my real knowledge<g>).
The device I am now attempting to utilize has a method named Advise in
its main device interface which has a parameter for the event
interface. This IDeviceNotification (here I quote from the
documentation) “provides the status of notification from the device.
It is prepared on the client side and passes this interface to the
Advise method of the “ device “interface. The IdeviceNotification
interface is a callback interface implemented with a client
application in otder to be notified from the Device Manager of device
connections & disconnections”.
AFAICS I must provide an instance of the IDeviceNotification to
receive the events & so call the Delphi events.
But as the device notification instance must be passed to the device
in the Advise method it appears to me that there is no connection
point available to use Binh Ly’s code, and I must write separate Code
and generate class entries in the Registry which reference my
implementation class in a dll so that I can generate an instance with
a call to CreateComObject.
OR can I implement the interface in a normal Delphi class implementing
the interface, and call that class’s “Create as IDeviceNotification”
and pass the returned reference in the Advise method, without having
to make my additional registry entries.
AFAICS Binh Ly’s code does not make a specific separate instance of
the interface but implements Delphi code which connects via the
connection point. Perhaps my new device does not have a connection
point and the Advise method is its external way of implementing what
Binh Ly does.
As you can see I have no real knowledge of interfaces and am
struggling. Any helpful comments will be gratefully received.
Alan Lloyd