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. InitInstance() Problem

InitInstance() Problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 6 Posters 0 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.
  • A Offline
    A Offline
    Anu_Bala
    wrote on last edited by
    #1

    Hi, In my application, first the CMainFrame construcotr is getting called and then only InitInstance() is called. What may be the problem? Pls help me.

    Anu

    L S _ C 4 Replies Last reply
    0
    • A Anu_Bala

      Hi, In my application, first the CMainFrame construcotr is getting called and then only InitInstance() is called. What may be the problem? Pls help me.

      Anu

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Anu_Bala wrote:

      What may be the problem?

      There is a bug in the code.

      Use the best guess

      1 Reply Last reply
      0
      • A Anu_Bala

        Hi, In my application, first the CMainFrame construcotr is getting called and then only InitInstance() is called. What may be the problem? Pls help me.

        Anu

        S Offline
        S Offline
        Shaheed Legion
        wrote on last edited by
        #3

        Hi Anu, we will not be able to help you much if you do not post some relevant code, perhaps your constructor and the context from which it is called.

        For awesome websites or just to chat check out my blog for more info. . .

        1 Reply Last reply
        0
        • A Anu_Bala

          Hi, In my application, first the CMainFrame construcotr is getting called and then only InitInstance() is called. What may be the problem? Pls help me.

          Anu

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          Normally, the CMainFrame object is constructed in the InitInstance method using the call -

          pDocTemplate = new CSingleDocTemplate(
          IDR_MAINFRAME,
          RUNTIME_CLASS(CSDIDoc),
          RUNTIME_CLASS(CMainFrame), // main SDI frame window
          RUNTIME_CLASS(CSDIView));

          Do you see this call in InitInstance? If you don't see this, it means that the construction is being done elsewhere; your app class constructor perhaps. If you do see the above code and you still have the behavior you mentioned, it could mean that some other CMainFrame instance is being constructed. Whatever the case, it is not the correct way to do it.

          «_Superman_»  _I love work. It gives me something to do between weekends.

          _Microsoft MVP (Visual C++) (October 2009 - September 2013)

          Polymorphism in C

          1 Reply Last reply
          0
          • A Anu_Bala

            Hi, In my application, first the CMainFrame construcotr is getting called and then only InitInstance() is called. What may be the problem? Pls help me.

            Anu

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #5

            Does, by chance, your InitInstance method return FALSE?

            Veni, vidi, vici.

            A 1 Reply Last reply
            0
            • C CPallini

              Does, by chance, your InitInstance method return FALSE?

              Veni, vidi, vici.

              A Offline
              A Offline
              Albert Holguin
              wrote on last edited by
              #6

              That would stop execution in its tracks...

              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