Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Creating Formatting Bar Pin
Hamid_RT3-Aug-07 18:44
Hamid_RT3-Aug-07 18:44 
QuestionCreate a wav file using existing wav files Pin
vikrant kpr3-Aug-07 7:56
vikrant kpr3-Aug-07 7:56 
AnswerRe: Create a wav file using existing wav files Pin
mid=57413-Aug-07 17:07
mid=57413-Aug-07 17:07 
AnswerRe: Create a wav file using existing wav files Pin
Karismatic3-Aug-07 20:38
Karismatic3-Aug-07 20:38 
QuestionAfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 5:59
Johpoke3-Aug-07 5:59 
AnswerRe: AfxBeginThread() with a function in the main class Pin
led mike3-Aug-07 6:13
led mike3-Aug-07 6:13 
QuestionRe: AfxBeginThread() with a function in the main class Pin
David Crow3-Aug-07 6:15
David Crow3-Aug-07 6:15 
AnswerRe: AfxBeginThread() with a function in the main class [modified] Pin
Mark Salsbery3-Aug-07 6:20
Mark Salsbery3-Aug-07 6:20 
The thread procedure accepts a void pointer which you can pass when you create the thread.

If you pass a pointer to an object of a class then you will have access to that object from the
thread.  If the thread proc is a static member function of that class, you have complete access
(to public/protected/private members).

class CThreadDemoDlg : public CDialog
{
<font face="Courier New">   static UINT __cdecl MyThreadProc(LPVOID pParam);</font>   
protected:
   <font face="Courier New">CWinThread *pAnotherThread; 
</font>public:
   void SomeThreadStarterFunc();
};

<font face="Courier New">void </font><font face="Courier New">CThreadDemoDlg::</font><font face="Courier New">SomeThreadStarterFunc()
{
   pAnotherThread = AfxBeginThread(&</font><font face="Courier New">CThreadDemoDlg::MyThreadProc, this);
}

UINT __cdecl </font><font face="Courier New">CThreadDemoDlg::MyThreadProc(LPVOID pParam)
{
   </font><font face="Courier New">CThreadDemoDlg *pMyDlg = (</font><font face="Courier New">CThreadDemoDlg *)pParam</font><font face="Courier New">;

   ...</font><font face="Courier New"><font><font></font></font>
}</font>

Mark


Last modified: 25mins after originally posted --


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

QuestionRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 6:39
Johpoke3-Aug-07 6:39 
AnswerRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 6:45
Mark Salsbery3-Aug-07 6:45 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 6:52
Johpoke3-Aug-07 6:52 
QuestionRe: AfxBeginThread() with a function in the main class Pin
David Crow3-Aug-07 6:54
David Crow3-Aug-07 6:54 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 6:59
Johpoke3-Aug-07 6:59 
QuestionRe: AfxBeginThread() with a function in the main class Pin
David Crow3-Aug-07 7:05
David Crow3-Aug-07 7:05 
AnswerRe: AfxBeginThread() with a function in the main class [Solved] Pin
Johpoke3-Aug-07 7:12
Johpoke3-Aug-07 7:12 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Ahmad Al-Maraghi4-Aug-07 1:50
Ahmad Al-Maraghi4-Aug-07 1:50 
AnswerRe: AfxBeginThread() with a function in the main class Pin
led mike3-Aug-07 7:08
led mike3-Aug-07 7:08 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 7:32
Mark Salsbery3-Aug-07 7:32 
GeneralRe: AfxBeginThread() with a function in the main class Pin
led mike3-Aug-07 7:43
led mike3-Aug-07 7:43 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 7:59
Johpoke3-Aug-07 7:59 
GeneralRe: AfxBeginThread() with a function in the main class Pin
led mike3-Aug-07 8:09
led mike3-Aug-07 8:09 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 8:14
Mark Salsbery3-Aug-07 8:14 
QuestionRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 8:27
Johpoke3-Aug-07 8:27 
AnswerRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 8:34
Mark Salsbery3-Aug-07 8:34 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 8:40
Johpoke3-Aug-07 8:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.