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. want to keep a window alive

want to keep a window alive

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++career
5 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.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    I call a dll from am MFC app MyApp From the dll I instantiate a CDialog like so tests = new CTests(0); I thought this would 'detach' the CDialog from the dll. Now after the dll has done its job, when I go to dismiss myApp, this CDialog vanishes too. I want to keep it around, but do want to get rid of MyApp. How do I manage this? I thougt for sure that putting the parent pointer as 0 would have done the trick.... :~ sb

    B J 2 Replies Last reply
    0
    • N ns

      I call a dll from am MFC app MyApp From the dll I instantiate a CDialog like so tests = new CTests(0); I thought this would 'detach' the CDialog from the dll. Now after the dll has done its job, when I go to dismiss myApp, this CDialog vanishes too. I want to keep it around, but do want to get rid of MyApp. How do I manage this? I thougt for sure that putting the parent pointer as 0 would have done the trick.... :~ sb

      B Offline
      B Offline
      Blake Miller
      wrote on last edited by
      #2

      All that code executing the window in the DLL belongs to your MyApp process, so when the MyApp process is gone, so is the DLL and the dialog. You might be able to hide the window for the MyApp, and thus still have the window from the DLL visible and processing user inpout on the screen. I've seen better runs in my shorts! - Patches O'Houlihan

      1 Reply Last reply
      0
      • N ns

        I call a dll from am MFC app MyApp From the dll I instantiate a CDialog like so tests = new CTests(0); I thought this would 'detach' the CDialog from the dll. Now after the dll has done its job, when I go to dismiss myApp, this CDialog vanishes too. I want to keep it around, but do want to get rid of MyApp. How do I manage this? I thougt for sure that putting the parent pointer as 0 would have done the trick.... :~ sb

        J Offline
        J Offline
        Jun Du
        wrote on last edited by
        #3

        From the design point of view, you need to understand these questions yourself: Why do I want to keep the dialog when I terminate my app? What is the purpose of the dialog, of the app? After I terminate the app, what does my dialog do? - It's easier to make than to correct a mistake.

        N 1 Reply Last reply
        0
        • J Jun Du

          From the design point of view, you need to understand these questions yourself: Why do I want to keep the dialog when I terminate my app? What is the purpose of the dialog, of the app? After I terminate the app, what does my dialog do? - It's easier to make than to correct a mistake.

          N Offline
          N Offline
          ns
          wrote on last edited by
          #4

          The CDialog is an addon to an existing app. Ithas a progres bar on it, plus a histogram and the user wants to retain this window and be able to proceed further. Right now he can't proceed further if this app is not shut down.

          J 1 Reply Last reply
          0
          • N ns

            The CDialog is an addon to an existing app. Ithas a progres bar on it, plus a histogram and the user wants to retain this window and be able to proceed further. Right now he can't proceed further if this app is not shut down.

            J Offline
            J Offline
            Jun Du
            wrote on last edited by
            #5

            You should make that dialog part of your app, instead of an addition. This way, your app will be cleaner and more robust. That being said, if you insist, you could keep the dialog alive after you terminate the app. Follow these steps: 1) Write another little app2, which handles the dialog. 2) Spawn app2 from within app. 3) Terminate app. This will no doubt create unnecessary complexities to your application. - It's easier to make than to correct a mistake.

            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