Modeless dialog hangs up
-
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.
-
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.
Hello Bhanu, Please check this article - Lengthy Operations Without Multiple Threads[^]. Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
-
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.
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.
-
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.
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.
-
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.
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.
-
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.
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.