Solved

Problem with threads

Posted on 1998-04-23
4
175 Views
Last Modified: 2010-04-10
I have created a ui thread class in an application and would like it to do
some work while returning control back to the main application.

problem is, when the thread starts running, (it starts a modeless dialog) it
effectively becomes modal, stop any user interaction with the main
application (please see the result.zip file for example).

I am sure I am not doing this properly!  How should it be done??

Also, I notice that when downloading has finished, if the dialog is not
destroyed, it sits in front of the main application window; can the dialog
be made to go behind, even if the main application window is the parent???

All answers to this perplexing problem would be very gratefully received.


Oscar


Check example url:

http://homepages.enterprise.net/impala/doc/Result.zip







0
Comment
Question by:ossentoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
faster earned 100 total points
ID: 1163480
You need modaless dialog.  I mean the UI thread shall first create the dialog, then go to the message loop.  Another thread do the background processing, such as download file, when it completes, send message to the dialog to kill it.  If the user select cancel in the UI thread, then it can terminate the working thread.
0
 

Author Comment

by:ossentoo
ID: 1163481
I'm sure it is a modeless dialog.  See code below:

      m_pDlg=new CDownDlg;
      //pDlg=(CDownDlg*)m_pDlgArr.ElementAt(m_pDlgArr.GetSize());
      BOOL bReturn=m_pDlg->Create(IDD_DOWNLOAD);
      m_pDlg->ShowWindow(SW_SHOWNORMAL);

      ASSERT(m_pDlg);


This code should create a modeless dialog.  I have used the create() method, not DoModal(), unless I am doing something else wrong!!
0
 
LVL 7

Expert Comment

by:faster
ID: 1163482
can you show me the other part of your code?
0
 

Author Comment

by:ossentoo
ID: 1163483
send me an e-mail to impala@enterprise.net  I will then send you the code.

Thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question