Click here to Skip to main content
15,888,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
AnswerRe: Question about list Box Pin
KarstenK30-Oct-06 0:52
mveKarstenK30-Oct-06 0:52 
AnswerRe: Question about list Box Pin
uday kiran janaswamy30-Oct-06 1:05
uday kiran janaswamy30-Oct-06 1:05 
GeneralRe: Question about list Box Pin
zizzzz30-Oct-06 1:18
zizzzz30-Oct-06 1:18 
GeneralRe: Question about list Box Pin
uday kiran janaswamy30-Oct-06 1:21
uday kiran janaswamy30-Oct-06 1:21 
GeneralRe: Question about list Box Pin
zizzzz30-Oct-06 1:36
zizzzz30-Oct-06 1:36 
GeneralRe: Question about list Box Pin
uday kiran janaswamy30-Oct-06 1:48
uday kiran janaswamy30-Oct-06 1:48 
GeneralRe: Question about list Box Pin
zizzzz30-Oct-06 2:16
zizzzz30-Oct-06 2:16 
AnswerRe: Question about list Box Pin
David Crow30-Oct-06 3:18
David Crow30-Oct-06 3:18 
GeneralRe: Question about list Box Pin
zizzzz30-Oct-06 3:23
zizzzz30-Oct-06 3:23 
QuestionHow to get the resources of parallel port on the system Pin
mt_samiei30-Oct-06 0:36
mt_samiei30-Oct-06 0:36 
QuestionMultiDocTemplate Pin
keyurbhatnagar30-Oct-06 0:16
keyurbhatnagar30-Oct-06 0:16 
AnswerRe: MultiDocTemplate Pin
Mark Salsbery30-Oct-06 5:31
Mark Salsbery30-Oct-06 5:31 
GeneralRe: MultiDocTemplate Pin
keyurbhatnagar30-Oct-06 17:46
keyurbhatnagar30-Oct-06 17:46 
GeneralRe: MultiDocTemplate Pin
Mark Salsbery30-Oct-06 18:26
Mark Salsbery30-Oct-06 18:26 
GeneralRe: MultiDocTemplate Pin
keyurbhatnagar30-Oct-06 19:09
keyurbhatnagar30-Oct-06 19:09 
QuestionEdit Pin
Sunil P V30-Oct-06 0:07
Sunil P V30-Oct-06 0:07 

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.