[vtkusers] Fwd: Re: cant not creat vtkMFCWindow

Pham Sy Quy phamsyquybk at gmail.com
Thu Sep 17 11:18:48 EDT 2009


For more information, i used visual studio 2008, vtk 5.4.2,

------- Forwarded message -------
From: "Pham Sy Quy" <phamsyquybk at gmail.com>
To: "John Drescher" <drescherjm at gmail.com>, VTK <vtkusers at vtk.org>
Cc:
Subject: Re: [vtkusers] cant not creat vtkMFCWindow
Date: Fri, 18 Sep 2009 00:14:49 +0900

I guess something not right in my project so i tried separated simple
project:
create a new VS project, Dialog Base type, add a picture control onto
dialog
name it as IDC_VTKVIEW, declare pvtkMFCWindow as a vtkMFCWindow*
and use following in initdialog.

this->pvtkMFCWindow = new vtkMFCWindow(this->GetDlgItem(IDC_MAINWIND));

The same runtime error occurred.

Are there anyone know what wrong, what i did miss?
Plz help.


On Thu, 10 Sep 2009 08:44:42 +0900, Pham Sy Quy <phamsyquybk at gmail.com>
wrote:

> Thanks for reply,
>
> It is main application thread (i used new prject wizard to make a dialog  
> based project)
> This window is create in OnInitDialog() function of my main dialog (like  
> vtkDLG example)
> it looks like:
>
> -------------------------------------------------
> BOOL CNoseMatchDlg::OnInitDialog()
> {
> 	CDialog::OnInitDialog();
>
> 	//....
>
> 	CMenu* pSysMenu = GetSystemMenu(FALSE);
> 	if (pSysMenu != NULL)
> 	{
> 		//...some thing here
> 	}
>
> 	// Set the icon for this dialog.  The framework does this automatically
> 	//  when the application's main window is not a dialog
> 	SetIcon(m_hIcon, TRUE);			// Set big icon
> 	SetIcon(m_hIcon, FALSE);		// Set small icon
>
> 	CWnd* pViewWind = this->GetDlgItem(IDC_STATIC_VIEW);
> 	test = new vtkMFCWindow(pViewWind);
>
> 	return TRUE;  // return TRUE  unless you set the f`ocus to a control
> }
> ---------------------------------------------------------
>
>
>
> On Thu, 10 Sep 2009 08:09:48 +0900, John Drescher <drescherjm at gmail.com>  
> wrote:
>
>> 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
>
>


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the vtkusers mailing list