CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    62

    Problems creating a CWnd

    Hi,

    I have to create a window on the screen (to show some graphics) and I have to do it without a dialog and decided to create a class derived from cwnd (it has to have a message queue for paint and timers and all that stuff) and gave it a function (which i can call from somewhere else) that does:

    int x = CWnd::CreateEx( WS_EX_CONTROLPARENT, NULL, "-", WS_CHILD | WS_VISIBLE, CRect(0,0,200,200), this, 1, 0);

    but it doesn't work but returns with False.

    could somebody please help me with this ?

  2. #2
    Join Date
    Nov 2007
    Posts
    613

    Re: Problems creating a CWnd

    Use
    Code:
    CWnd wnd;
    wnd.CreateEx(.........
    You'll see nothing, add at least WS_BORDER.
    Define a window class or use an existing one.

    I doubt you'll be happy with the result. To have a well working MDI child of an MDI parent in an MFC application you should use the document/view mechanism to add a second CView derived class (and, maybe, a document class).
    Last edited by srelu; December 9th, 2007 at 07:22 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured