Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Non blocking socket problem Pin
Mike Dimmick6-Mar-05 1:39
Mike Dimmick6-Mar-05 1:39 
Generalresponses will be Rendering Page Flip effect Pin
Shahzaib Saleem6-Mar-05 0:54
Shahzaib Saleem6-Mar-05 0:54 
QuestionHow to use compiled help in VS NET? Pin
IlanTal6-Mar-05 0:30
IlanTal6-Mar-05 0:30 
AnswerRe: How to use compiled help in VS NET? Pin
Mike Dimmick6-Mar-05 1:47
Mike Dimmick6-Mar-05 1:47 
GeneralRe: How to use compiled help in VS NET? Pin
IlanTal6-Mar-05 18:20
IlanTal6-Mar-05 18:20 
GeneralPassing parameters to CreateThread() Pin
Nikhil Wason5-Mar-05 19:29
Nikhil Wason5-Mar-05 19:29 
GeneralRe: Passing parameters to CreateThread() Pin
Lim Bio Liong5-Mar-05 22:42
Lim Bio Liong5-Mar-05 22:42 
GeneralRe: Passing parameters to CreateThread() Pin
Lim Bio Liong5-Mar-05 22:50
Lim Bio Liong5-Mar-05 22:50 
Hello Nikhil,

Also, when you call CreateThread(), you may pass a pointer to your X instance as follows :

hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)(ThreadProc),this,0,NULL);

Note the "this" is passed as the 4th parameter to CreateThread().

Then, in ThreadProc(), you may cast the input parameter back to an X pointer, e.g. :

DWORD WINAPI X::ThreadProc(LPVOID lpParameter)
{
X* pX = (X*)lpParameter;
DWORD dwRet = 0;

return dwRet;
}

Note that because ThreadProc(), although a "global" function, is within the X namespace and so may access the private or protected members of an X instance.

For example :

class X
{
protected :
HANDLE hThread;

private :
int m_i;

public:
X();

protected :
static DWORD WINAPI ThreadProc(LPVOID lpParameter);
};

Note that m_i is "private". But your ThreadProc() function may access X::m_i :

DWORD WINAPI X::ThreadProc(LPVOID lpParameter)
{
X* pX = (X*)lpParameter;
DWORD dwRet = 0;

pX -> m_i = 100;

return dwRet;
}


Hope the above helps, Nikhil.

Best Regards,
Bio.




GeneralRe: Passing parameters to CreateThread() Pin
Michael Dunn6-Mar-05 4:24
sitebuilderMichael Dunn6-Mar-05 4:24 
GeneralMFC & GDI+ Pin
Chis MU5-Mar-05 16:20
Chis MU5-Mar-05 16:20 
Generalplease I need help Pin
waway5-Mar-05 14:05
waway5-Mar-05 14:05 
GeneralRe: please I need help Pin
Ravi Bhavnani6-Mar-05 12:32
professionalRavi Bhavnani6-Mar-05 12:32 
GeneralProtection error: debugger detected Pin
aritosteles5-Mar-05 14:05
aritosteles5-Mar-05 14:05 
GeneralRe: Protection error: debugger detected Pin
aritosteles14-Mar-05 17:14
aritosteles14-Mar-05 17:14 
GeneralRe: Protection error: debugger detected Pin
Dave Midgley25-Feb-11 23:40
Dave Midgley25-Feb-11 23:40 
GeneralUsing Visual Basic 6 dll in Visual C++ 6 Pin
Kumarunster5-Mar-05 10:45
Kumarunster5-Mar-05 10:45 
GeneralRe: Using Visual Basic 6 dll in Visual C++ 6 Pin
Mike Dimmick5-Mar-05 12:51
Mike Dimmick5-Mar-05 12:51 
Generalhard time with dll Pin
gamitech5-Mar-05 10:33
gamitech5-Mar-05 10:33 
GeneralCTabCtrl Pin
lino_i5-Mar-05 10:17
lino_i5-Mar-05 10:17 
GeneralVisual Studio for Web Page Design Pin
Grahamfff5-Mar-05 8:27
Grahamfff5-Mar-05 8:27 
GeneralRe: Visual Studio for Web Page Design Pin
alex.barylski5-Mar-05 10:04
alex.barylski5-Mar-05 10:04 
GeneralMapping Mode Pin
LiYS5-Mar-05 4:10
LiYS5-Mar-05 4:10 
QuestionWhot is wrong with this .h file? Pin
Glich5-Mar-05 3:16
Glich5-Mar-05 3:16 
AnswerRe: Whot is wrong with this .h file? Pin
Maximilien5-Mar-05 3:30
Maximilien5-Mar-05 3:30 
GeneralRe: Whot is wrong with this .h file? Pin
Glich5-Mar-05 7:28
Glich5-Mar-05 7:28 

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.