Hi, is m_mainWnd valid and not NULL?

Another thing: if you create a buffer with new[] you need to use "delete []" to free the memory, otherwise you get undefined behaviour and/or a memory leak.

Ginsengelf