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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. OnInitDialog() not getting called?

OnInitDialog() not getting called?

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 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.
  • M Offline
    M Offline
    mikert_2008
    wrote on last edited by
    #1

    Hi, I have an Dialog based application. In which I created the Dialog and derived the class for that Dialog box. I write OnInitDialog() function inside derived class but it's not getting called when I call DoModal For that dialog. I am calling DoModal from the Main dialog class which gets created when project creted. Systax for calling is below: void CtestDialog2Dlg::OnBnClickedButton1() { CDialog testDlg(IDD_TEST_DIALOG10); testDlg.DoModal();// Should call OnInitDialog()??? } What I might be missing?? Mike

    _ N 2 Replies Last reply
    0
    • M mikert_2008

      Hi, I have an Dialog based application. In which I created the Dialog and derived the class for that Dialog box. I write OnInitDialog() function inside derived class but it's not getting called when I call DoModal For that dialog. I am calling DoModal from the Main dialog class which gets created when project creted. Systax for calling is below: void CtestDialog2Dlg::OnBnClickedButton1() { CDialog testDlg(IDD_TEST_DIALOG10); testDlg.DoModal();// Should call OnInitDialog()??? } What I might be missing?? Mike

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      Did you try to debug the macros that are called before the OnInitDialog function call.

      You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

      1 Reply Last reply
      0
      • M mikert_2008

        Hi, I have an Dialog based application. In which I created the Dialog and derived the class for that Dialog box. I write OnInitDialog() function inside derived class but it's not getting called when I call DoModal For that dialog. I am calling DoModal from the Main dialog class which gets created when project creted. Systax for calling is below: void CtestDialog2Dlg::OnBnClickedButton1() { CDialog testDlg(IDD_TEST_DIALOG10); testDlg.DoModal();// Should call OnInitDialog()??? } What I might be missing?? Mike

        N Offline
        N Offline
        Nuri Ismail
        wrote on last edited by
        #3

        See this line from your code:

        mikert_2008 wrote:

        CDialog testDlg(IDD_TEST_DIALOG10);

        You are creating the dialog as a standard CDialog!

        mikert_2008 wrote:

        I created the Dialog and derived the class for that Dialog box.

        Then use your class. For example, if your derived dialog is called CMyDerivedDialog create your dialog like this:

        void CtestDialog2Dlg::OnBnClickedButton1()
        {
        CMyDerivedDialog testDlg;
        testDlg.DoModal();
        }

        and you should be able to catch the OnInitDialog(). :)

        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