?
Solved

Creating MFC user interface threads

Posted on 2002-04-17
7
Medium Priority
?
313 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

770 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