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. cleanly teminating an invisible dialog application;

cleanly teminating an invisible dialog application;

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
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.
  • P Offline
    P Offline
    pc_dev
    wrote on last edited by
    #1

    I have used following technique to make dialog invisible at startup; which i have taken from Nishant Sivakumar's article "Some handy dialog box tricks, tips and workarounds". void CTest_deleteDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) { if(!visible) lpwndpos->flags &= ~SWP_SHOWWINDOW; CDialog::OnWindowPosChanging(lpwndpos); } The problem is how can i terminate cleanly an invisible dialog application I have tried following; 1. Sending postmessage(wm_close) to dialog but it donot work; probably because the dialog is invisible. 2. OnOK() is also not working. 3. Showing the dialog and immediately and sending close message produces a splash therefore avoided. 3. exit(1) works fine but I am not sure that it teminates application cleanly or not so, I want to avoid this. 4. calling the Exit instance of main application even donot work! ((CMYApp*)AfxGetApp())->ExitInstance(); this should work because I am calling application object exit? but it wont? I am looking for a clean solution to terminate a hidden dialog application. Thanks in advance.:rose:

    K R V T 4 Replies Last reply
    0
    • P pc_dev

      I have used following technique to make dialog invisible at startup; which i have taken from Nishant Sivakumar's article "Some handy dialog box tricks, tips and workarounds". void CTest_deleteDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) { if(!visible) lpwndpos->flags &= ~SWP_SHOWWINDOW; CDialog::OnWindowPosChanging(lpwndpos); } The problem is how can i terminate cleanly an invisible dialog application I have tried following; 1. Sending postmessage(wm_close) to dialog but it donot work; probably because the dialog is invisible. 2. OnOK() is also not working. 3. Showing the dialog and immediately and sending close message produces a splash therefore avoided. 3. exit(1) works fine but I am not sure that it teminates application cleanly or not so, I want to avoid this. 4. calling the Exit instance of main application even donot work! ((CMYApp*)AfxGetApp())->ExitInstance(); this should work because I am calling application object exit? but it wont? I am looking for a clean solution to terminate a hidden dialog application. Thanks in advance.:rose:

      K Offline
      K Offline
      khan
      wrote on last edited by
      #2

      You could try: (Haven't tested it) PostQuitMessage(0); this is this.

      1 Reply Last reply
      0
      • P pc_dev

        I have used following technique to make dialog invisible at startup; which i have taken from Nishant Sivakumar's article "Some handy dialog box tricks, tips and workarounds". void CTest_deleteDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) { if(!visible) lpwndpos->flags &= ~SWP_SHOWWINDOW; CDialog::OnWindowPosChanging(lpwndpos); } The problem is how can i terminate cleanly an invisible dialog application I have tried following; 1. Sending postmessage(wm_close) to dialog but it donot work; probably because the dialog is invisible. 2. OnOK() is also not working. 3. Showing the dialog and immediately and sending close message produces a splash therefore avoided. 3. exit(1) works fine but I am not sure that it teminates application cleanly or not so, I want to avoid this. 4. calling the Exit instance of main application even donot work! ((CMYApp*)AfxGetApp())->ExitInstance(); this should work because I am calling application object exit? but it wont? I am looking for a clean solution to terminate a hidden dialog application. Thanks in advance.:rose:

        R Offline
        R Offline
        Ryan Binns
        wrote on last edited by
        #3

        Try PostQuitMessage(). It will destroy the main window and terminate the application.

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        1 Reply Last reply
        0
        • P pc_dev

          I have used following technique to make dialog invisible at startup; which i have taken from Nishant Sivakumar's article "Some handy dialog box tricks, tips and workarounds". void CTest_deleteDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) { if(!visible) lpwndpos->flags &= ~SWP_SHOWWINDOW; CDialog::OnWindowPosChanging(lpwndpos); } The problem is how can i terminate cleanly an invisible dialog application I have tried following; 1. Sending postmessage(wm_close) to dialog but it donot work; probably because the dialog is invisible. 2. OnOK() is also not working. 3. Showing the dialog and immediately and sending close message produces a splash therefore avoided. 3. exit(1) works fine but I am not sure that it teminates application cleanly or not so, I want to avoid this. 4. calling the Exit instance of main application even donot work! ((CMYApp*)AfxGetApp())->ExitInstance(); this should work because I am calling application object exit? but it wont? I am looking for a clean solution to terminate a hidden dialog application. Thanks in advance.:rose:

          V Offline
          V Offline
          Vinaya
          wrote on last edited by
          #4

          Check this.. PostQuitMessage(0); Vini

          1 Reply Last reply
          0
          • P pc_dev

            I have used following technique to make dialog invisible at startup; which i have taken from Nishant Sivakumar's article "Some handy dialog box tricks, tips and workarounds". void CTest_deleteDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) { if(!visible) lpwndpos->flags &= ~SWP_SHOWWINDOW; CDialog::OnWindowPosChanging(lpwndpos); } The problem is how can i terminate cleanly an invisible dialog application I have tried following; 1. Sending postmessage(wm_close) to dialog but it donot work; probably because the dialog is invisible. 2. OnOK() is also not working. 3. Showing the dialog and immediately and sending close message produces a splash therefore avoided. 3. exit(1) works fine but I am not sure that it teminates application cleanly or not so, I want to avoid this. 4. calling the Exit instance of main application even donot work! ((CMYApp*)AfxGetApp())->ExitInstance(); this should work because I am calling application object exit? but it wont? I am looking for a clean solution to terminate a hidden dialog application. Thanks in advance.:rose:

            T Offline
            T Offline
            ThatsAlok
            wrote on last edited by
            #5

            What about Same old EndDialog()

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

            cheers, Alok Gupta VC Forum Q&A :- I/ IV

            D 1 Reply Last reply
            0
            • T ThatsAlok

              What about Same old EndDialog()

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

              cheers, Alok Gupta VC Forum Q&A :- I/ IV

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

              I concur.


              "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

              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