Hello,

My app crashes when I attempt to create a CWnd as shown below. I am attempting to create the CWnd with a a parent of type CFormView. Does anyone know why this might be crashing?

Code:
CWnd::Create(AfxRegisterWndClass(CS_DBLCLKS), CString(windowName.c_str()), WS_VISIBLE | WS_BORDER, dimensions, parent, NULL, NULL);
The call stack looks like this:

Code:
mfc100ud.dll!AfxGetInstanceHandle()  Line 21 + 0x20 bytes	C++
mfc100ud.dll!AfxRegisterWndClass(unsigned int nClassStyle, HICON__ * hCursor, HBRUSH__ * hbrBackground, HICON__ * hIcon)  Line 1462 + 0x5 bytes	C++
and the line that crashes here us the AfxGetInstanceHandle() call:

Code:
LPCTSTR AFXAPI AfxRegisterWndClass(UINT nClassStyle,
	HCURSOR hCursor, HBRUSH hbrBackground, HICON hIcon)
{
	// Returns a temporary string name for the class
	//  Save in a CString if you want to use it for a long time
	LPTSTR lpszName = AfxGetThreadState()->m_szTempClassName;

	// generate a synthetic name for this class
	HINSTANCE hInst = AfxGetInstanceHandle();