kushcu
asked on
creating a window with CWnd::CreateEx() problem
I derived a class called CAnimWnd from CWnd, registered the window with the call to AfxRegisterWndClass() and then tried to call CreateEx():
BOOL CAnimWnd::Create(const char* pszTitle,DWORD dwStyle, CWnd* pParent, int x, int y, int cx, int cy)
{
const char* pszClassName
= AfxRegisterWndClass(CS_HRE DRAW | CS_VREDRAW);
return CWnd::CreateEx(0, pszClassName, pszTitle, dwStyle, x, y, cx, cy, NULL, NULL);
}
somehow the CWnd::CreateEx() returns false, and the window is not created. For what reasons does the CreateEx() func. returns false?
Any comment is appreciated, working answer receives an A.
BOOL CAnimWnd::Create(const char* pszTitle,DWORD dwStyle, CWnd* pParent, int x, int y, int cx, int cy)
{
const char* pszClassName
= AfxRegisterWndClass(CS_HRE
return CWnd::CreateEx(0, pszClassName, pszTitle, dwStyle, x, y, cx, cy, NULL, NULL);
}
somehow the CWnd::CreateEx() returns false, and the window is not created. For what reasons does the CreateEx() func. returns false?
Any comment is appreciated, working answer receives an A.
or simply U post the creation code we'l find out the problem.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I notice you pass the CWnd* pParent to your derived class Create function, but you do not pass this on to the CreateEx function. Are you settings the WS_CHILD style while setting the parent to NULL?
~Lockias
~Lockias
ASKER
i'm kind of in my midterm period right now, i'll check your comments out when i have the time, thanks.
ASKER
I tried a diiferent approach to this question that works fine, and feel the need to transfer the points to someone..
Thanks for all your time.
Thanks for all your time.
Warning: Window creation failed: GetLastError returns ???
Where ??? is a hex number you can lookup using the "Error lookup" utility.