Click here to Skip to main content
15,896,153 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Passing classes into threads Pin
David Crow28-Apr-04 8:52
David Crow28-Apr-04 8:52 
GeneralRe: Passing classes into threads Pin
roadragedave28-Apr-04 8:55
roadragedave28-Apr-04 8:55 
GeneralRe: Passing classes into threads Pin
David Crow28-Apr-04 9:00
David Crow28-Apr-04 9:00 
GeneralRe: Passing classes into threads Pin
roadragedave28-Apr-04 9:11
roadragedave28-Apr-04 9:11 
GeneralRe: Passing classes into threads Pin
David Crow28-Apr-04 9:15
David Crow28-Apr-04 9:15 
GeneralRe: Passing classes into threads Pin
roadragedave28-Apr-04 9:24
roadragedave28-Apr-04 9:24 
GeneralRe: Passing classes into threads Pin
Michael Dunn28-Apr-04 14:05
sitebuilderMichael Dunn28-Apr-04 14:05 
GeneralRe: Passing classes into threads Pin
Jitendra gangwar28-Apr-04 19:05
Jitendra gangwar28-Apr-04 19:05 
Did some modification in your existing code. This would help you.
For the passing parameter to thread, first cast it to DWORD and receive it in callback handler of thread,cast it back to its original type,now use it as you want.

void main(void){

DWORD loadPerThrdID;
HANDLE loadPerThrd;
TCHAR szMsg[80];

DWORD dwThrdParam;

static WmiWrapper Wmi(NULL, NULL, NULL); //Creating object

loadPerThrd = CreateThread(
NULL, 0,
loadPerThrdFunc,
//&dwThrdParam,
(DWORD) &Wmi, //Pass the object pointer as a thread parameter.
0, &loadPerThrdID);

if(loadPerThrd == NULL){
wsprintf(szMsg, (TEXT("Create Thread failed for LoadPercentage")));
MessageBox(NULL, szMsg, NULL, MB_OK);
}
else{
_getch();
CloseHandle(loadPerThrd);
}
}

//Threads function
DWORD WINAPI loadPerThrdFunc (DWORD param1)
{
WmiWrapper* wmi = (WmiWrapper*) param1;
//Now you can use this wmi class pointer.
................
}


Jitendra
GeneralRe: Passing classes into threads Pin
roadragedave28-Apr-04 22:58
roadragedave28-Apr-04 22:58 
GeneralRe: Passing classes into threads Pin
Paul Ranson28-Apr-04 23:36
Paul Ranson28-Apr-04 23:36 
GeneralRe: Passing classes into threads Pin
Jitendra gangwar29-Apr-04 1:33
Jitendra gangwar29-Apr-04 1:33 
Questionhow can i dynamically get my machine ip address ? Pin
Marco M.28-Apr-04 6:17
Marco M.28-Apr-04 6:17 
AnswerRe: how can i dynamically get my machine ip address ? Pin
David Crow28-Apr-04 7:03
David Crow28-Apr-04 7:03 
AnswerRe: how can i dynamically get my machine ip address ? Pin
toxcct28-Apr-04 7:09
toxcct28-Apr-04 7:09 
AnswerRe: how can i dynamically get my machine ip address ? Pin
RNEELY28-Apr-04 8:16
RNEELY28-Apr-04 8:16 
GeneralRe: how can i dynamically get my machine ip address ? Pin
RNEELY28-Apr-04 9:09
RNEELY28-Apr-04 9:09 
QuestionFrequent open/close registry key? Pin
Gibson_66628-Apr-04 5:48
Gibson_66628-Apr-04 5:48 
AnswerRe: Frequent open/close registry key? Pin
David Crow28-Apr-04 7:10
David Crow28-Apr-04 7:10 
GeneralWeb Browser Pin
Moschous Manos28-Apr-04 5:28
Moschous Manos28-Apr-04 5:28 
GeneralMFC application with COM objects Pin
Brian van der Beek28-Apr-04 5:01
Brian van der Beek28-Apr-04 5:01 
GeneralRe: uint32 printing problem Pin
Trollslayer28-Apr-04 5:00
mentorTrollslayer28-Apr-04 5:00 
GeneralRe: uint32 printing problem Pin
roadragedave28-Apr-04 6:14
roadragedave28-Apr-04 6:14 
GeneralRe: uint32 printing problem Pin
David Crow28-Apr-04 7:22
David Crow28-Apr-04 7:22 
QuestionPlugin for VC++ that distributes the compiling across the network? Pin
Gywox28-Apr-04 4:39
Gywox28-Apr-04 4:39 
GeneralCMDIChildWnd maximized Pin
alex.barylski28-Apr-04 4:21
alex.barylski28-Apr-04 4:21 

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.