Thread: CView initialization

  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607

    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
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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, 12:42 PM
  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-27-2005, 12:44 AM
  5. Globals initialization
    By New++ in forum C++ Programming
    Replies: 3
    Last Post: 12-30-2004, 01:11 PM