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. Modeless dialog hangs up

Modeless dialog hangs up

Scheduled Pinned Locked Moved C / C++ / MFC
c++
6 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.
  • B Offline
    B Offline
    bhanu_8509
    wrote on last edited by
    #1

    Dear All, I create a modeless dialog in my MFC and in the dialog I read a big file (15 MB) on a button click even. Until the code the finished reading the dialog hangs up. This means when I switch to other application then my modeless dialog is not viewable. I dont want to use threads to read the file to run in a separate process. Is it possible to make the dialog accessible when it reads a big file. Please advice me. Many thanks in advance.

    J M L 3 Replies Last reply
    0
    • B bhanu_8509

      Dear All, I create a modeless dialog in my MFC and in the dialog I read a big file (15 MB) on a button click even. Until the code the finished reading the dialog hangs up. This means when I switch to other application then my modeless dialog is not viewable. I dont want to use threads to read the file to run in a separate process. Is it possible to make the dialog accessible when it reads a big file. Please advice me. Many thanks in advance.

      J Offline
      J Offline
      Jijo Raj
      wrote on last edited by
      #2

      Hello Bhanu, Please check this article - Lengthy Operations Without Multiple Threads[^]. Regards, Jijo.

      _____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

      1 Reply Last reply
      0
      • B bhanu_8509

        Dear All, I create a modeless dialog in my MFC and in the dialog I read a big file (15 MB) on a button click even. Until the code the finished reading the dialog hangs up. This means when I switch to other application then my modeless dialog is not viewable. I dont want to use threads to read the file to run in a separate process. Is it possible to make the dialog accessible when it reads a big file. Please advice me. Many thanks in advance.

        M Offline
        M Offline
        Michael Schubert
        wrote on last edited by
        #3

        Not very popular but have a look at this: The Code Project Visual C++ Forum FAQ[^] You would have to call this on a regular basis to keep the UI responsive.

        1 Reply Last reply
        0
        • B bhanu_8509

          Dear All, I create a modeless dialog in my MFC and in the dialog I read a big file (15 MB) on a button click even. Until the code the finished reading the dialog hangs up. This means when I switch to other application then my modeless dialog is not viewable. I dont want to use threads to read the file to run in a separate process. Is it possible to make the dialog accessible when it reads a big file. Please advice me. Many thanks in advance.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Hi, the correct way to do this is by adding one thread; there is no separate process involved. your main thread should be available for GUI operations, hence not be involved in lengthy operations. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.


          B 1 Reply Last reply
          0
          • L Luc Pattyn

            Hi, the correct way to do this is by adding one thread; there is no separate process involved. your main thread should be available for GUI operations, hence not be involved in lengthy operations. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.


            B Offline
            B Offline
            bhanu_8509
            wrote on last edited by
            #5

            Dear Jijo, Michael Schubert and Luc Pattyn , Thank you so much for your kind replies. I followed the approach suggested by Michael Schubert ( I mean pumping message). Actually I dont want to use the Threads. Can you please tell whether pumping messages is unsafe and Thread is safe ? Many thanks in advance.

            M 1 Reply Last reply
            0
            • B bhanu_8509

              Dear Jijo, Michael Schubert and Luc Pattyn , Thank you so much for your kind replies. I followed the approach suggested by Michael Schubert ( I mean pumping message). Actually I dont want to use the Threads. Can you please tell whether pumping messages is unsafe and Thread is safe ? Many thanks in advance.

              M Offline
              M Offline
              Michael Schubert
              wrote on last edited by
              #6

              bhanu_8509 wrote:

              Can you please tell whether pumping messages is unsafe

              Not to my knowledge. In fact, you can mess up things easily (if not written properly) by using threads because of synchronisation issues. However, the "PumpMessage" method is still a "hack" whereas using threads should be the preferred approach.

              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