Board index » delphi » TAPI component callback question

TAPI component callback question

Hello all,
      I have a question. I have a program that uses TAPI to retrieve
CallerID data from the modem. It works great. So, since I have gotten so
much help from other people in the past, I wanted to make this into a
non-visual component and offer it as freeware for everyone to use (I've seen
commercial ones run anywhere from $50-$300). Anyway, as with other API's
that send messages back to the program, TAPI uses a callback proc. Is there
any possibility of putting a callback into a component? If I understand it
correctly, it cannot be put into any object, since it is a callback proc,
but the callback is the key to using TAPI. Any thoughts would be
appreciated...

my email is e...@lakeozark.net.

Thanks in advance,
Eric...

 

Re:TAPI component callback question


Quote
Eric wrote in message <6sblui$n1...@supernews.com>...
>      I have a question. I have a program that uses TAPI to retrieve
>CallerID data from the modem. It works great. So, since I have gotten so
>much help from other people in the past, I wanted to make this into a
>non-visual component and offer it as freeware for everyone to use (I've
seen
>commercial ones run anywhere from $50-$300). Anyway, as with other API's
>that send messages back to the program, TAPI uses a callback proc. Is there
>any possibility of putting a callback into a component? If I understand it
>correctly, it cannot be put into any object, since it is a callback proc,
>but the callback is the key to using TAPI. Any thoughts would be
>appreciated...

Create the real callback outside the component. Also create a global var
which stores the instance of the component. When the real callback is
called, call a method using the global var.
You'll have a problem when your component is used multiple times on a form,
or on multiple forms. Either prevent this, or store all instances in a list
and have the callback sort out which instance to call.

--
Zweitze de Vries
Zweitze.at.iname.com
When replying, please adjust return address

Re:TAPI component callback question


On Sun, 30 Aug 1998 18:00:58 +0200, "Zweitze de Vries"

Quote
<zweitze.at.iname.com> wrote:
>Eric wrote in message <6sblui$n1...@supernews.com>...
>>      I have a question. I have a program that uses TAPI to retrieve
>>CallerID data from the modem. It works great. So, since I have gotten so
>>much help from other people in the past, I wanted to make this into a
>>non-visual component and offer it as freeware for everyone to use (I've
>seen
>>commercial ones run anywhere from $50-$300). Anyway, as with other API's
>>that send messages back to the program, TAPI uses a callback proc. Is there
>>any possibility of putting a callback into a component? If I understand it
>>correctly, it cannot be put into any object, since it is a callback proc,
>>but the callback is the key to using TAPI. Any thoughts would be
>>appreciated...

>Create the real callback outside the component. Also create a global var
>which stores the instance of the component. When the real callback is
>called, call a method using the global var.
>You'll have a problem when your component is used multiple times on a form,
>or on multiple forms. Either prevent this, or store all instances in a list
>and have the callback sort out which instance to call.

That's why callback functions are always defined with at least one DWORD
of caller-supplied data as a parameter.  Use it to pass a pointer to the
original calling object.  Cast it back to a pointer to the calling
object in the callback.

--
Report all {*word*201} mail to your Potsmaster.

Re:TAPI component callback question


Thanks for the help guys. I'll try that...

Eric...

Quote
David Rifkind wrote in message

<35e9d30c.27346...@netnews.worldnet.att.net>...
Quote
>On Sun, 30 Aug 1998 18:00:58 +0200, "Zweitze de Vries"
><zweitze.at.iname.com> wrote:
>>Eric wrote in message <6sblui$n1...@supernews.com>...
>>>      I have a question. I have a program that uses TAPI to retrieve
>>>CallerID data from the modem. It works great. So, since I have gotten so
>>>much help from other people in the past, I wanted to make this into a
>>>non-visual component and offer it as freeware for everyone to use (I've
>>seen
>>>commercial ones run anywhere from $50-$300). Anyway, as with other API's
>>>that send messages back to the program, TAPI uses a callback proc. Is
there
>>>any possibility of putting a callback into a component? If I understand
it
>>>correctly, it cannot be put into any object, since it is a callback proc,
>>>but the callback is the key to using TAPI. Any thoughts would be
>>>appreciated...

>>Create the real callback outside the component. Also create a global var
>>which stores the instance of the component. When the real callback is
>>called, call a method using the global var.
>>You'll have a problem when your component is used multiple times on a
form,
>>or on multiple forms. Either prevent this, or store all instances in a
list
>>and have the callback sort out which instance to call.

>That's why callback functions are always defined with at least one DWORD
>of caller-supplied data as a parameter.  Use it to pass a pointer to the
>original calling object.  Cast it back to a pointer to the calling
>object in the callback.

>--
>Report all {*word*201} mail to your Potsmaster.

Other Threads