i am a beginner in MFC programming and using MS VC++ 6.0. I am trying to create my own window using AfxRegisterWndClass(). My code is as follows :

Frame::Frame()
{
	LPCTSTR className;
	HBRUSH brush;
	brush = (HBRUSH) ::GetStockObject (BLACK_BRUSH);
        className = ::AfxRegisterWndClass (WS_OVERLAPPEDWINDOW,         AfxGetApp()->LoadStandardCursor (IDC_CROSS),
brush,
AfxGetApp()->LoadStandardIcon (IDI_ERROR));
	Create (className, "BHOOT");
//	Create (NULL, "Bhoot", WS_OVERLAPPEDWINDOW, rectDefault, NULL, NULL, 0, NULL);
}

The above code segment shows the constructor of Frame class, the class derived from CFrameWnd. Also, FYI, i havent used document/view architecture.
Now, my problem is when i run my code, i meet with an error saying :
" This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for further information."

however, when i dont register my own window class and rather proceed with a frame using CWnd::Create() function, i dont face any such error.

can anyone throw some light on my problem.?? :|

i am a beginner in MFC programming and using MS VC++ 6.0. I am trying to create my own window using AfxRegisterWndClass(). My code is as follows :

Frame::Frame()
{
	LPCTSTR className;
	HBRUSH brush;
	brush = (HBRUSH) ::GetStockObject (BLACK_BRUSH);
        className = ::AfxRegisterWndClass (WS_OVERLAPPEDWINDOW,         AfxGetApp()->LoadStandardCursor (IDC_CROSS),
brush,
AfxGetApp()->LoadStandardIcon (IDI_ERROR));
	Create (className, "BHOOT");
//	Create (NULL, "Bhoot", WS_OVERLAPPEDWINDOW, rectDefault, NULL, NULL, 0, NULL);
}

Don't use window styles there, instead specify a combination of class styles, see http://msdn.microsoft.com/en-us/library/ms633574(VS.85).aspx#class_styles

Don't use window styles there, instead specify a combination of class styles, see http://msdn.microsoft.com/en-us/library/ms633574(VS.85).aspx#class_styles

:D
bro...thank you so much..this problem had eaten my head off since a day and a half.. :(
:@
but you solved it out.. :)
i even went to the point of replacing some dlls in system...lolz...
because the people at Microsoft advised to do so for this error... :@
anyways ..thank you so much again... :)
:D

This article has been dead for over six months. Start a new discussion instead.