Click here to Skip to main content
15,917,997 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralHi,MFC and big data files Pin
Jamie Kenyon28-Apr-04 8:58
Jamie Kenyon28-Apr-04 8:58 
GeneralRe: Hi,MFC and big data files Pin
David Crow28-Apr-04 9:02
David Crow28-Apr-04 9:02 
GeneralRe: Hi,MFC and big data files Pin
Jamie Kenyon28-Apr-04 12:21
Jamie Kenyon28-Apr-04 12:21 
GeneralRe: Hi,MFC and big data files Pin
l a u r e n28-Apr-04 14:29
l a u r e n28-Apr-04 14:29 
GeneralRe: Hi,MFC and big data files Pin
Jamie Kenyon28-Apr-04 23:01
Jamie Kenyon28-Apr-04 23:01 
GeneralRe: Hi,MFC and big data files Pin
David Crow29-Apr-04 2:40
David Crow29-Apr-04 2:40 
GeneralPut the suo and ncb files in another directory Pin
Anonymous28-Apr-04 8:03
Anonymous28-Apr-04 8:03 
GeneralRe: Put the suo and ncb files in another directory Pin
Anonymous28-Apr-04 8:18
Anonymous28-Apr-04 8:18 
GeneralRe: Put the suo and ncb files in another directory Pin
David Crow28-Apr-04 8:55
David Crow28-Apr-04 8:55 
GeneralRe: Put the suo and ncb files in another directory Pin
Anonymous28-Apr-04 9:15
Anonymous28-Apr-04 9:15 
QuestionThread and UpdateData?? Pin
bryanbryan28-Apr-04 7:12
bryanbryan28-Apr-04 7:12 
AnswerRe: Thread and UpdateData?? Pin
David Crow28-Apr-04 7:25
David Crow28-Apr-04 7:25 
GeneralToolbox and VC++.NET Pin
pmdanger28-Apr-04 7:03
pmdanger28-Apr-04 7:03 
GeneralPassing classes into threads Pin
roadragedave28-Apr-04 6:58
roadragedave28-Apr-04 6:58 
GeneralRe: Passing classes into threads Pin
David Crow28-Apr-04 7:19
David Crow28-Apr-04 7:19 
GeneralRe: Passing classes into threads Pin
roadragedave28-Apr-04 8:31
roadragedave28-Apr-04 8:31 
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 

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.