Re: TAPI sample in VC++ using MFC

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: DBard (DBard_at_discussions.microsoft.com)
Date: 08/18/04


Date: Wed, 18 Aug 2004 11:47:02 -0700

I modified your sample into an MFC program and am new to ATL/COM programming.

It seems as though I can put the CoInitializeEx just about anywhere, but no
matter where I put the CoUninitialize I get the crash. I've tried putting it
in both the Dlg's and base file's code in areas which dismiss the program. I
did have both in the function which did the TAPI stuff. How do I tell if the
function dismissed it itself? Any other thoughts?

Regarding 2.x vs. 3.x I need the H323 and G711 functionality, which MS
documentation leads me to believe is only available in 3.x. That true?

- David

"William DePalo [MVP VC++]" wrote:

> "DBard" <DBard@discussions.microsoft.com> wrote in message
> news:C1475692-E8B9-4C63-911A-D4B4C13E3DA9@microsoft.com...
> > One problem remains in the sample code.
>
> Really?
>
> > I get an application error and a
> > crash when the MakeTapiCall function exits.
>
> In my _unmodified_ sample? :-)
>
> > I've been able to narrow it down
> > to:
> >
> > pEnumAddress = pTapi->EnumerateAddresses();
> >
> > Any ideas? Does this have to be "de-enumerated" or something?
>
> Are you new to ATL/COM? ATL "smart" COM-pointer classes call Release() when
> the object goes out of scope. For "automatic" (aka stack-based ) objects
> that happens on leaving the function where the are defined. If that function
> has already called CoUninitialize() then COM is gone and bad things can
> happen. That's why in my litle sample you'll find the CoInitialize() and
> CoUninitialize() in main() and the TAPI/COM stuff in a separate function.
>
> Now, I'm not saying this is the problem, but it is a common C++/ATL/COM
> beginner's mistake. It is something to look at. I don't have any way of
> testing H.323 here but I would expect you'd just have to change the
> destination number and the destination type in my sample. If doing that
> doesn't work then I don't know what the problem is.
>
> Just by the way, I only cooked up that sample because someone asked. I
> remain convinced that TAPI version 2.1 (procedural though it is), with a set
> of application classes to the problem at hand is the way to go. Just my
> opinion, others may (and do) disagree.
>
> > Thanks again.
>
> You are welcome.
>
> Regards,
> Will
>
>
>



Relevant Pages

  • Re: MTA with Thread Pool API
    ... Microsoft technical article says to do for proper connection pooling. ... CoUninitialize() in regards to the thread pool API. ... CoInitializeEx, but I still have no opportunity to call CoUninitialize. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: MTA with Thread Pool API
    ... Microsoft technical article says to do for proper connection pooling. ... my question is related to CoInitializeEx/ CoUninitialize() ... Storage, I can flag whether or not the thread has called CoInitializeEx, ... some way that I can use the thread pool API? ...
    (microsoft.public.win32.programmer.kernel)
  • Re: MTA with Thread Pool API
    ... process holds on to it's own connection object, ... my question is related to CoInitializeEx/ CoUninitialize() ... Storage, I can flag whether or not the thread has called CoInitializeEx, ... some way that I can use the thread pool API? ...
    (microsoft.public.win32.programmer.kernel)
  • Re: WMI connect
    ... You call CoUninitialize() and leave COM interface (IWbemServices) alive. ... Try to move CoInitializeEx, CoInitializeSecurity and CoUninitialize on ... still cannot get it to work on any local machine. ...
    (microsoft.public.win32.programmer.wmi)