Solved

Problem with threads

Posted on 1998-04-23
4
169 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
Comment Utility
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
Comment Utility
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
Comment Utility
can you show me the other part of your code?
0
 

Author Comment

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

Thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now