[vtkusers] cant not creat vtkMFCWindow

John Drescher drescherjm at gmail.com
Wed Sep 9 19:09:48 EDT 2009


On Wed, Sep 9, 2009 at 6:50 PM, Pham Sy Quy <phamsyquybk at gmail.com> wrote:
> Hi all,
>
> I have a problem with creating vtkMFCWindow object.
> I refered to vtkDLG examples (VTKExamples/vtkDLG)and make a similar project
> trying to
> display vtk's ouput in an area on Dialog (use Picture Control, set
> OnwerDraw)
>
> test = new vtkMFCWindow(this->GetDlgItem(IDC_STATIC_VIEW));
>
> here test declared as: vtkMFCWindow* ; this statement is called in
> OnInitDialog()
>
> I got a runtime assert in afxwin1.inl
>
> _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
>        { ASSERT(afxCurrentInstanceHandle != NULL);
>                return afxCurrentInstanceHandle; }
>
> here is call stack
>
> mfc90d.dll!AfxGetInstanceHandle()  Line 21 + 0x20 bytes C++
> mfc90d.dll!AfxEndDeferRegisterClass(long fToRegister=1)  Line 4509 + 0x5
> bytes   C++
> mfc90d.dll!CWnd::PreCreateWindow(tagCREATESTRUCTA & cs={...})  Line 733 +
> 0x7 bytes       C++
> mfc90d.dll!CWnd::CreateEx(unsigned long dwExStyle=0, const char *
> lpszClassName=0x00000000, const char * lpszWindowName=0x1076db08, unsigned
> long dwStyle=1409286144, int x=0, int y=0, int nWidth=1, int nHeight=1,
> HWND__ * hWndParent=0x00070fe8, HMENU__ * nIDorHMenu=0xffffffff, void *
> lpParam=0x00000000)  Line 699 + 0x11 bytes      C++
> mfc90d.dll!CWnd::Create(const char * lpszClassName=0x00000000, const char *
> lpszWindowName=0x1076db08, unsigned long dwStyle=1409286144, const tagRECT &
> rect={...}, CWnd * pParentWnd=0x02dd8614, unsigned int nID=4294967295,
> CCreateContext * pContext=0x00000000)  Line 757 C++
> vtkMFC.dll!vtkMFCWindow::vtkMFCWindow(CWnd * pcWnd=0x02dd8614)  Line 77 +
> 0x2c bytes      C++
>
> Did i miss something?
> Please help!
>

Are you trying to create this window in a dll or a thread that is not
the same as the main application thread?

John



More information about the vtkusers mailing list