Solved

Problem with threads

Posted on 1998-04-23
4
173 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
  • 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

861 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