[vtkusers] Fwd: how to quit VTK when close the MFC single dialog ?
David Cole
DLRdave at aol.com
Sun Apr 26 08:54:43 EDT 2015
Please keep replies on the mailing list. Everyone benefits from seeing the
whole discussion, and you have a better chance of the person with the
answer seeing it and chiming in...
I don't know what else might be wrong with your entire application just by
seeing the listing of the subset of lines of a single function in
your source code. Perhaps you could provide more context, or a reproducible
test case that the rest of us could actually build and run? An example that
demonstrates the problem would help us figure it out.
D
---------- Forwarded message ----------
From: *15891495523 at 126.com <15891495523 at 126.com>* <15891495523 at 126.com>
Date: Saturday, April 25, 2015
Subject: [vtkusers] how to quit VTK when close the MFC single dialog ?
To: David Cole <DLRdave at aol.com>
Dear David
I have tried your suggestion that don't use
m_pRenderWindowInteractor->Start().
But, when I close the MFC dialog, the exe is still survived in the
process.
All classes I defined in the header file, I set the reference count to
0 by SetReferenceCount function.
what can I do in the next step?
My code is :
m_pImageViewer->SetInputData(m_pImageData);
m_pImageViewer->SetParentId(GetDlgItem(IDC_STATIC)->m_hWnd);
m_pImageViewer->SetupInteractor(m_pRenderWindowInteractor);
m_pImageViewer->SetSize(rect.Width(),rect.Height());
m_pRenderWindowInteractor->Render();
m_pImageViewer->GetRenderer()->ResetCamera();
m_pImageViewer->Render();
Thanks vary much !
Zhang Qiang
------------------------------
*From:* David Cole <javascript:_e(%7B%7D,'cvml','DLRdave at aol.com');>
*Date:* 2015-04-24 20:31
*To:* zhq <javascript:_e(%7B%7D,'cvml','15891495523 at 126.com');>
*Subject:* Re: [vtkusers] how to quit VTK when close the MFC single dialog ?
Don't call "m_pRenderWindowInteractor->Start();" -- that starts a
message loop which will not exit until a Win32 call to
PostQuitMessage. But MFC also starts a message loop, and it requires
its own PostQuitMessage to exit properly...
Since only one PostQuitMessage gets issued when you close the MFC
dialog, only one of the message loops gets exited. The other one
persists waiting for a future PostQuitMessage.
Simply not calling Start avoids the problem. Start should only be used
if you are NOT using MFC, Qt, or some other GUI framework that already
does a message loop for you...
HTH,
David C.
On Fri, Apr 24, 2015 at 7:27 AM, zhq <15891495523 at 126.com
<javascript:_e(%7B%7D,'cvml','15891495523 at 126.com');>> wrote:
>
> I am learning coding VTK based on the MFC single dialog ? And it's ok for
me
> to read a picture in MFC dialog. But after I close the dialog, I find the
> exe is still survived in the computer progress. So how can I quit the VTK
> after I close the dialog ?
>
> My code is :
>
> m_pImageViewer->SetInputData(m_pImageData);
> m_pImageViewer->SetParentId(GetDlgItem(IDC_STATIC)->m_hWnd);
> m_pImageViewer->SetupInteractor(m_pRenderWindowInteractor);
> m_pImageViewer->SetSize(rect.Width(),rect.Height());
> m_pRenderWindowInteractor->Render();
> m_pImageViewer->Render();
> m_pImageViewer->GetRenderer()->ResetCamera();
> m_pRenderWindowInteractor->Start();
>
>
>
> --
> View this message in context:
http://vtk.1045678.n5.nabble.com/how-to-quit-VTK-when-close-the-MFC-single-dialog-tp5731600.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150426/656ef2eb/attachment.html>
More information about the vtkusers
mailing list