adding a thread

Posted on 2004-11-08
Medium Priority
Last Modified: 2013-11-20
Hi all,
  I am writing an addin .dll. I need to add another thread to my addin. How do I do this. The .dll uses mfc!

500 pts.
Question by:struggling_coder_3203
  • 2
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12528520
Don't worry about MFC, just have to create another thead with WinAPI CreateThread() function.
Your function won't be a member of a MFC class (will be global) but still you can use any MFC object.

LVL 86

Expert Comment

ID: 12529371
In general, I'd recommend http://msdn.microsoft.com/library/en-us/dndllpro/html/msdn_threads.asp ("Multithreading for Rookies") as a lecture regarding this issue. It comes with quite some sample code.

Author Comment

ID: 12541483
well, how would I do it with a class derived from CWinThread???
LVL 86

Accepted Solution

jkr earned 1500 total points
ID: 12547957
Here's a good tutorial for that: http://www.codeproject.com/threads/threads_and_mfc.asp ("Threads with MFC"). Bsically, you'd use

UINT MyThreadProc( LPVOID pParam ) {

    // ...

CWinThread* pThrd = AfxBeginThread(MyThreadProc,NULL);

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

864 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