?
Solved

adding a thread

Posted on 2004-11-08
4
Medium Priority
?
177 Views
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.
0
Comment
Question by:struggling_coder_3203
  • 2
4 Comments
 
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.

0
 
LVL 86

Expert Comment

by:jkr
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.
0
 

Author Comment

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

Accepted Solution

by:
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);
0

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