A error throwed out when I ceate a CWnd in a dll?
-
I want to create a CWnd in my dll,the dll file was called by a dialog based program.In the dll ,I use function as follow to create a CWnd:
static CThreadManager *theManager=new CThreadManager;
if(theManager->CreateEx(WS_EX_TRANSPARENT,"TheManager","ThreadManager",WS_POPUP,rc,pWnd,ID_WND,NULL))
{
AfxMessageBox("create successfully!");
}
else
{
CString str;
UINT nCode=GetLastError();
str.Format("error occured and the error code is %d",nCode);
AfxMessageBox(str);}
the paramter pWnd is a pointer to the Dialog which called the dll,and the Macro ID_WND is a definition for the CWnd. I found that when these code execute,the function CreateEx(...) return FALSE. But the error code is equal to 0.And I look up MSDN and find that error code 0 is stand for "The operation completed successfully." I don't know how to deal with it ! And anybody please help me ? Thanks a lot! :confused: Don't look at me in that way!
-
I want to create a CWnd in my dll,the dll file was called by a dialog based program.In the dll ,I use function as follow to create a CWnd:
static CThreadManager *theManager=new CThreadManager;
if(theManager->CreateEx(WS_EX_TRANSPARENT,"TheManager","ThreadManager",WS_POPUP,rc,pWnd,ID_WND,NULL))
{
AfxMessageBox("create successfully!");
}
else
{
CString str;
UINT nCode=GetLastError();
str.Format("error occured and the error code is %d",nCode);
AfxMessageBox(str);}
the paramter pWnd is a pointer to the Dialog which called the dll,and the Macro ID_WND is a definition for the CWnd. I found that when these code execute,the function CreateEx(...) return FALSE. But the error code is equal to 0.And I look up MSDN and find that error code 0 is stand for "The operation completed successfully." I don't know how to deal with it ! And anybody please help me ? Thanks a lot! :confused: Don't look at me in that way!
The second parameter of CreateEx() is the name of the registered window class. Have you registered the window class "TheManager" previously via a call to AfxRegisterWndClass()? Dave
-
The second parameter of CreateEx() is the name of the registered window class. Have you registered the window class "TheManager" previously via a call to AfxRegisterWndClass()? Dave
Thank you ! I Register the class and the function was return TRUE; Thank you! Don't look at me in that way!