Click here to Skip to main content
15,899,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: info about __COUNTER__ macro Pin
Waldermort30-Oct-06 3:07
Waldermort30-Oct-06 3:07 
GeneralRe: info about __COUNTER__ macro Pin
manustone30-Oct-06 4:13
manustone30-Oct-06 4:13 
QuestionMemory usage Pin
Waldermort30-Oct-06 2:13
Waldermort30-Oct-06 2:13 
AnswerRe: Memory usage Pin
David Crow30-Oct-06 2:49
David Crow30-Oct-06 2:49 
AnswerRe: Memory usage Pin
Waldermort30-Oct-06 3:04
Waldermort30-Oct-06 3:04 
GeneralRe: Memory usage Pin
Hamid_RT30-Oct-06 3:55
Hamid_RT30-Oct-06 3:55 
GeneralRe: Memory usage Pin
Waldermort30-Oct-06 4:13
Waldermort30-Oct-06 4:13 
GeneralRe: Memory usage Pin
Hamid_RT30-Oct-06 6:31
Hamid_RT30-Oct-06 6:31 
GeneralRe: Memory usage Pin
Waldermort30-Oct-06 7:13
Waldermort30-Oct-06 7:13 
GeneralRe: Memory usage Pin
Hamid_RT30-Oct-06 8:14
Hamid_RT30-Oct-06 8:14 
GeneralRe: Memory usage Pin
Stephen Hewitt30-Oct-06 12:06
Stephen Hewitt30-Oct-06 12:06 
QuestionCallback function Pin
PasNad30-Oct-06 2:13
PasNad30-Oct-06 2:13 
AnswerRe: Callback function Pin
Emilio Garavaglia30-Oct-06 2:53
Emilio Garavaglia30-Oct-06 2:53 
AnswerRe: Callback function Pin
Rage30-Oct-06 2:56
professionalRage30-Oct-06 2:56 
AnswerRe: Callback function Pin
Hamid_RT30-Oct-06 3:37
Hamid_RT30-Oct-06 3:37 
AnswerRe: Callback function Pin
Zac Howland30-Oct-06 3:38
Zac Howland30-Oct-06 3:38 
GeneralRe: Callback function Pin
PasNad30-Oct-06 14:06
PasNad30-Oct-06 14:06 
GeneralRe: Callback function Pin
Zac Howland31-Oct-06 5:02
Zac Howland31-Oct-06 5:02 
Questionregistering a plugin Pin
saqib8230-Oct-06 1:58
saqib8230-Oct-06 1:58 
AnswerRe: registering a plugin Pin
albertino callientes30-Oct-06 2:28
albertino callientes30-Oct-06 2:28 
GeneralRe: registering a plugin Pin
saqib8230-Oct-06 2:32
saqib8230-Oct-06 2:32 
GeneralRe: registering a plugin Pin
led mike30-Oct-06 5:32
led mike30-Oct-06 5:32 
QuestionFunction Pointer or Class Pointer ? Pin
Mr.Brainley30-Oct-06 1:15
Mr.Brainley30-Oct-06 1:15 
AnswerRe: Function Pointer or Class Pointer ? Pin
Blake Miller30-Oct-06 3:55
Blake Miller30-Oct-06 3:55 
I favor passing a pointer to 'this'.

Inside the static function, you cast the LPVOID to a 'this' pointer and then call the virtual function 'Run'.

Therefore, if someone dervies from your thread class, the static function will always call the 'Run' of the derived class. I am not sure of the behavior if you pass in the Run pointer directly, from the base class, not sure you would get the Run of the dervied class to execute.

My static thread runner functions typically have two lines in them:

DWORD WINAPI CWorkerThread::StaticThreadFunction(LPVOID lpParameter)<br />
{<br />
    CWorkerThread* pRunner = (CWorkerThread*)lpParameter;<br />
    return pRunner->Run();<br />
}


It really is that simple!


Any sufficiently gross incompetence is nearly indistinguishable from malice.

QuestionQuestion about list Box Pin
zizzzz30-Oct-06 0:40
zizzzz30-Oct-06 0: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.