CView initialization

This is a discussion on CView initialization within the Windows Programming forums, part of the Platform Specific Boards category; I've read bunches of MFC documents including msdn and the MFC help and haven't figured this out. I want to ...

  1. #1
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,586

    CView initialization

    I've read bunches of MFC documents including msdn and the MFC help and haven't figured this out.

    I want to init my view as soon as the app starts w/o the user having to hit File->New.

    For SDI, OnInitialUpdate() is never called. And for non doc/view there is no OnInitialUpdate().

    So how would I go about initializing the view as soon as the application starts?
    I cannot do it from CWinApp::InitInstance() because the view and document have not been activated. GetActiveView() and GetActiveDocument() both return NULL from within CWinApp::InitInstance().

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    several choices such as constructor, oncreate, etc.

    Kuphryn

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,586
    OnCreate() is not called when the framework creates everything.
    The constructor will not work b/c the Windows object does not exist at that time so calling GetClientRect() or anything else to init another window will not work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A problem with pointer initialization
    By zyklon in forum C Programming
    Replies: 5
    Last Post: 01-17-2009, 11:42 AM
  2. Assignment vs. Initialization
    By arrgh in forum C Programming
    Replies: 6
    Last Post: 05-06-2008, 03:08 AM
  3. initialize constant and initialization list
    By sawer in forum C++ Programming
    Replies: 5
    Last Post: 07-09-2006, 06:30 AM
  4. class initialization and the = operator
    By krygen in forum C++ Programming
    Replies: 3
    Last Post: 01-26-2005, 11:44 PM
  5. Globals initialization
    By New++ in forum C++ Programming
    Replies: 3
    Last Post: 12-30-2004, 12:11 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21