I figured it out accidentally, still don&#39;t know why :-)<div><br></div><div>I change project setting Character Set from Unicode Set to Multi-Byte character set. and it works.</div><div><br></div><div><div><br><div class="gmail_quote">
2009/9/18 Pham Sy Quy <span dir="ltr">&lt;<a href="mailto:phamsyquybk@gmail.com">phamsyquybk@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
For more information, i used visual studio 2008, vtk 5.4.2,<div><div></div><div class="h5"><br>
<br>
------- Forwarded message -------<br>
From: &quot;Pham Sy Quy&quot; &lt;<a href="mailto:phamsyquybk@gmail.com" target="_blank">phamsyquybk@gmail.com</a>&gt;<br>
To: &quot;John Drescher&quot; &lt;<a href="mailto:drescherjm@gmail.com" target="_blank">drescherjm@gmail.com</a>&gt;, VTK &lt;<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>&gt;<br>
Cc:<br>
Subject: Re: [vtkusers] cant not creat vtkMFCWindow<br>
Date: Fri, 18 Sep 2009 00:14:49 +0900<br>
<br>
I guess something not right in my project so i tried separated simple<br>
project:<br>
create a new VS project, Dialog Base type, add a picture control onto<br>
dialog<br>
name it as IDC_VTKVIEW, declare pvtkMFCWindow as a vtkMFCWindow*<br>
and use following in initdialog.<br>
<br>
this-&gt;pvtkMFCWindow = new vtkMFCWindow(this-&gt;GetDlgItem(IDC_MAINWIND));<br>
<br>
The same runtime error occurred.<br>
<br>
Are there anyone know what wrong, what i did miss?<br>
Plz help.<br>
<br>
<br>
On Thu, 10 Sep 2009 08:44:42 +0900, Pham Sy Quy &lt;<a href="mailto:phamsyquybk@gmail.com" target="_blank">phamsyquybk@gmail.com</a>&gt;<br>
wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks for reply,<br>
<br>
It is main application thread (i used new prject wizard to make a dialog based project)<br>
This window is create in OnInitDialog() function of my main dialog (like vtkDLG example)<br>
it looks like:<br>
<br>
-------------------------------------------------<br>
BOOL CNoseMatchDlg::OnInitDialog()<br>
{<br>
        CDialog::OnInitDialog();<br>
<br>
        //....<br>
<br>
        CMenu* pSysMenu = GetSystemMenu(FALSE);<br>
        if (pSysMenu != NULL)<br>
        {<br>
                //...some thing here<br>
        }<br>
<br>
        // Set the icon for this dialog.  The framework does this automatically<br>
        //  when the application&#39;s main window is not a dialog<br>
        SetIcon(m_hIcon, TRUE);                 // Set big icon<br>
        SetIcon(m_hIcon, FALSE);                // Set small icon<br>
<br>
        CWnd* pViewWind = this-&gt;GetDlgItem(IDC_STATIC_VIEW);<br>
        test = new vtkMFCWindow(pViewWind);<br>
<br>
        return TRUE;  // return TRUE  unless you set the f`ocus to a control<br>
}<br>
---------------------------------------------------------<br>
<br>
<br>
<br>
On Thu, 10 Sep 2009 08:09:48 +0900, John Drescher &lt;<a href="mailto:drescherjm@gmail.com" target="_blank">drescherjm@gmail.com</a>&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, Sep 9, 2009 at 6:50 PM, Pham Sy Quy &lt;<a href="mailto:phamsyquybk@gmail.com" target="_blank">phamsyquybk@gmail.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
I have a problem with creating vtkMFCWindow object.<br>
I refered to vtkDLG examples (VTKExamples/vtkDLG)and make a similar project<br>
trying to<br>
display vtk&#39;s ouput in an area on Dialog (use Picture Control, set<br>
OnwerDraw)<br>
<br>
test = new vtkMFCWindow(this-&gt;GetDlgItem(IDC_STATIC_VIEW));<br>
<br>
here test declared as: vtkMFCWindow* ; this statement is called in<br>
OnInitDialog()<br>
<br>
I got a runtime assert in afxwin1.inl<br>
<br>
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()<br>
       { ASSERT(afxCurrentInstanceHandle != NULL);<br>
               return afxCurrentInstanceHandle; }<br>
<br>
here is call stack<br>
<br>
mfc90d.dll!AfxGetInstanceHandle()  Line 21 + 0x20 bytes C++<br>
mfc90d.dll!AfxEndDeferRegisterClass(long fToRegister=1)  Line 4509 + 0x5<br>
bytes   C++<br>
mfc90d.dll!CWnd::PreCreateWindow(tagCREATESTRUCTA &amp; cs={...})  Line 733 +<br>
0x7 bytes       C++<br>
mfc90d.dll!CWnd::CreateEx(unsigned long dwExStyle=0, const char *<br>
lpszClassName=0x00000000, const char * lpszWindowName=0x1076db08, unsigned<br>
long dwStyle=1409286144, int x=0, int y=0, int nWidth=1, int nHeight=1,<br>
HWND__ * hWndParent=0x00070fe8, HMENU__ * nIDorHMenu=0xffffffff, void *<br>
lpParam=0x00000000)  Line 699 + 0x11 bytes      C++<br>
mfc90d.dll!CWnd::Create(const char * lpszClassName=0x00000000, const char *<br>
lpszWindowName=0x1076db08, unsigned long dwStyle=1409286144, const tagRECT &amp;<br>
rect={...}, CWnd * pParentWnd=0x02dd8614, unsigned int nID=4294967295,<br>
CCreateContext * pContext=0x00000000)  Line 757 C++<br>
vtkMFC.dll!vtkMFCWindow::vtkMFCWindow(CWnd * pcWnd=0x02dd8614)  Line 77 +<br>
0x2c bytes      C++<br>
<br>
Did i miss something?<br>
Please help!<br>
<br>
</blockquote>
<br>
Are you trying to create this window in a dll or a thread that is not<br>
the same as the main application thread?<br>
<br>
John<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
<br>
-- <br>
Using Opera&#39;s revolutionary e-mail client: <a href="http://www.opera.com/mail/" target="_blank">http://www.opera.com/mail/</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>------------------------------------------------------------------<br>Pham Sy Quy<br>HCI Lab, Advanced Fusion Technology Department, <br>Room 1211, New Millennium Building<br>
Konkuk University, Seoul, Korea<br>Mobile: +82-10-6413-1206<br>------------------------------------------------------------------<br>
</div></div>