Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating MFC user interface threads

Posted on 2002-04-17
7
Medium Priority
?
324 Views
Last Modified: 2013-11-20
I would like to know how to create a user interface thread in MFC. I need to create a Listctrl window in it's own thread. What are the steps to follow using the Winthread class.
0
Comment
Question by:WarrenW
[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
7 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 400 total points
ID: 6947793
Check the MTMDI sample (should be on your VC++ CD; here's the MSDN link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/_sample_mfc_mtmdi.asp)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Multithreading.3a_.Creating_User.2d.Interface_Threads.asp ("Multithreading: Creating User-Interface Threads") might also be of interest, as well as http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0197/formsp3/formsp3.htm&nav=/msj/0197/newnav.htm ("Hide Your Data and Make Objects Responsible for Their Own User Interfaces")
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 6947834

0
 

Assisted Solution

by:Jedimaster
Jedimaster earned 400 total points
ID: 6967631
First create a new class that has the base class CWinThread.

  class CmyThread : public CWinThread


then in the class you want to create it in delare a instance of you CWinThread class:

  CmyThread mythread;

 
Then where you want to start your GUI thread call:

  myThread = (CDriveThread*) AfxBeginThread(RUNTIME_CLASS(CDriveThread),0,0,0,NULL);

Remember when you want to exit the thread you must call AfxEndThread from inside the thread to correctly end the thread.


Hope that helps.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 11404012
where is my comment ???
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

636 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