Hi experts,
I am a little confused.. I am trying to include into a mfc dialog-based project a child window created with CWnd class, but I can't get this code working:
CProp::CProp(CWnd* pParent) //Note pParent is the CWnd pointer to my parent window
{
//int x = CWnd::CreateEx(NULL, AfxRegisterWndClass(NULL),
NULL, WS_CHILD|WS_VISIBLE|WS_DLG
FRAME,0, 0, 120, 120, pParent, (HMENU)NULL);
UINT nID = 1234;
CWnd* pWnd = new CWnd;
LPCTSTR ClassName = (LPCTSTR)AfxRegisterWndCla
ss(CS_VRED
RAW | CS_HREDRAW,NULL,(HBRUSH)CO
LOR_BACKGR
OUND + 1,NULL);
pWnd->CreateEx(0, ClassName, "Win", WS_CHILD | WS_CAPTION|WS_VISIBLE|WS_D
LGFRAME,
0, 0, 580, 100, pParent->m_hWnd, (HMENU)NULL);
pWnd->ShowWindow(SW_SHOWNO
RMAL);
pWnd->CenterWindow();
}
I am always getting Warning: Window creation failed: GetLastError returns 0x0000057E that Lookup says: "Cannot create a top-level child window."
How to solve the problem?
And once created, some link or whatever to understand how window messages (paint, lmouseclick,etc..) may be handled? DoDataExchange system is still available in CWnd windows?
I have a big mess in my mind, any help about this "bad-documented" topic is greatly appreciated
Start Free Trial