As Victor already suggested, most possible you are calling CWnd::Create... in a wrong way/place, trying to re-create the current window. That asserts in a debug build and may crash in a release one.

One aside note: why are you using boogie-woogie code like this?
Code:
... CString(windowName.c_str()) ...
As long as you are using MFC, CString MFC class is enough for handling strings.
std::string does not help much, just can give you more headaches.