Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. A error throwed out when I ceate a CWnd in a dll?

A error throwed out when I ceate a CWnd in a dll?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    white jungle
    wrote on last edited by
    #1

    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!

    D 1 Reply Last reply
    0
    • W white jungle

      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!

      D Offline
      D Offline
      Dave Bryant
      wrote on last edited by
      #2

      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

      W 1 Reply Last reply
      0
      • D Dave Bryant

        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

        W Offline
        W Offline
        white jungle
        wrote on last edited by
        #3

        Thank you ! I Register the class and the function was return TRUE; Thank you! Don't look at me in that way!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups