assertion when destroying ATL window
  Home FAQ Contact Sign in
microsoft.public.vc.atl only
 
Advanced search
POPULAR GROUPS

more...

microsoft.public.vc.atl Profile…
 Up
assertion when destroying ATL window         


Author: kombat
Date: May 1, 2008 16:25

i'm having issues where calling destroywindow causes a ->release call
on the com object that is my window, without m_hWnd being nullified,
hence assertion.

my outer code creates the com object and runs a message loop, so i
don't understand why the refcount goes down to 0 while the message-
loop is still processing messages.

this is my main code:

CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);

CComObject* main = NULL;
HRESULT hr = CComObject::CreateInstance(&main);
main->Create(NULL);
_Module.Lock();
main->ShowWindow(nCmdShow);
int nRet = theLoop.Run();
_Module.RemoveMessageLoop();

when i destroy the window i simply call DestroyWindow from within a
message handler.

any help would be appreciated
1 Comment
Re: assertion when destroying ATL window         


Author: Igor Tandetnik
Date: May 1, 2008 16:39

kombat gmail.com> wrote:
> i'm having issues where calling destroywindow causes a ->release call
> on the com object that is my window, without m_hWnd being nullified,
> hence assertion.
>
> my outer code creates the com object and runs a message loop, so i
> don't understand why the refcount goes down to 0 while the message-
> loop is still processing messages.
>
> this is my main code:
>
> CMessageLoop theLoop;
> _Module.AddMessageLoop(&theLoop);
>
> CComObject* main = NULL;
> HRESULT hr = CComObject::CreateInstance(&main);
Show full article (0.98Kb)
no comments