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. DoModal returns -1

DoModal returns -1

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
7 Posts 4 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
    AnsGe
    wrote on last edited by
    #1

    Hai All, In my application InitInstance method the DoModal() calling of main application dialog return -1(bcoz of some loading problem). but i want to capture it and show some error mesage. But i cann't show any error message or any other dialog when it returns -1. How i can i solve this problem. ANyone can have any idea? regards Ans

    T D M 3 Replies Last reply
    0
    • A AnsGe

      Hai All, In my application InitInstance method the DoModal() calling of main application dialog return -1(bcoz of some loading problem). but i want to capture it and show some error mesage. But i cann't show any error message or any other dialog when it returns -1. How i can i solve this problem. ANyone can have any idea? regards Ans

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      use GetLastError()


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      1 Reply Last reply
      0
      • A AnsGe

        Hai All, In my application InitInstance method the DoModal() calling of main application dialog return -1(bcoz of some loading problem). but i want to capture it and show some error mesage. But i cann't show any error message or any other dialog when it returns -1. How i can i solve this problem. ANyone can have any idea? regards Ans

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        AnsGe wrote: But i cann't show any error message or any other dialog when it returns -1. The reason is most likely here.


        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        A 1 Reply Last reply
        0
        • D David Crow

          AnsGe wrote: But i cann't show any error message or any other dialog when it returns -1. The reason is most likely here.


          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          A Offline
          A Offline
          AnsGe
          wrote on last edited by
          #4

          Hai, I tried with ur help. But my problem still remains. If main window is successfully loaded then it is possible to show any mesagebox. But the main window Domodal() failed then it is not possible to show a MessageBox. The code snip running, but windows are not visible Thanks Anish

          D 1 Reply Last reply
          0
          • A AnsGe

            Hai All, In my application InitInstance method the DoModal() calling of main application dialog return -1(bcoz of some loading problem). but i want to capture it and show some error mesage. But i cann't show any error message or any other dialog when it returns -1. How i can i solve this problem. ANyone can have any idea? regards Ans

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            Whenever I've had DoModal() return -1 it was due to the dialog using a control whose window class wasn't registered yet. If you're running an older OS and are using any Win 95 common controls, check that you're calling InitCommonControls() in your init code. --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb

            A 1 Reply Last reply
            0
            • M Michael Dunn

              Whenever I've had DoModal() return -1 it was due to the dialog using a control whose window class wasn't registered yet. If you're running an older OS and are using any Win 95 common controls, check that you're calling InitCommonControls() in your init code. --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb

              A Offline
              A Offline
              AnsGe
              wrote on last edited by
              #6

              hai, Thanks for ur reply. i know the exact reason why it retuns -1. bcoz one my ocx is not installed in the machine. But i want to capture the situation and want to display error message. I have done all hte initialisations in the InitInstance Thanks Ans

              1 Reply Last reply
              0
              • A AnsGe

                Hai, I tried with ur help. But my problem still remains. If main window is successfully loaded then it is possible to show any mesagebox. But the main window Domodal() failed then it is not possible to show a MessageBox. The code snip running, but windows are not visible Thanks Anish

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                AnsGe wrote: ...then it is not possible to show a MessageBox. Did you comment out the m_pMainWnd = &dlg statement in the app's InitInstance() method?


                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                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