vtkMFCWindow crashes in debug mode

Hi there,

I am using vtkMFCWindow object to link vtk to MFC. I create a Cstatic object and pass it on to the constructor as in

m_vtkmfcWindow = new vtkMFCWindow (pWnd);

This code works well in release mode, but crashes in debug mode. The following is the error message:
Debug Assertion Failed!
Program: Windows\system32\mfc140d.dll
File: \agent_work\2\s\src…\afxwin1.inl
Line 21
Further checking reveals the application executable has triggered a break point at line 88 of vtkMFCWindow.cpp
BOOL created = CWnd::Create(nullptr,…)

Would be grateful for any help.

Platform Windows 10, 2004
VTK version 8.2
Visual Studio 2015 professional.

Thanks in advance.

If you are saying that is run in release, then you need carefully check the difference settings between Debug and Release. Eventually, you can post here the code where you created and placed vtkMFCWindow on your CStatic object.

Thanks for your prompt reply. I will check the settings and revert along with the code I used to create the window. Preliminary observation suggests the create window function returns a funny value causing the assert statement to crash.

Thanks a lot for your advice. The problem is solved. I had to set character set under general configuration to use multi-byte character set and remove any reference to unicode from the pre compiled header file, stdafx.h.

Once again thanks a lot for your timely help.

You are wellcome :slight_smile: