Click here to Skip to main content
15,908,115 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Need a solution Pin
Arman S.28-Apr-07 1:12
Arman S.28-Apr-07 1:12 
GeneralRe: Need a solution Pin
yaminisridaran29-Apr-07 17:44
yaminisridaran29-Apr-07 17:44 
AnswerRe: Need a solution Pin
Hamid_RT28-Apr-07 8:44
Hamid_RT28-Apr-07 8:44 
QuestionNeed help in Threading in win32 Pin
amitmistry_petlad 27-Apr-07 22:58
amitmistry_petlad 27-Apr-07 22:58 
AnswerRe: Need help in Threading in win32 Pin
Arman S.27-Apr-07 23:11
Arman S.27-Apr-07 23:11 
GeneralRe: Need help in Threading in win32 Pin
amitmistry_petlad 27-Apr-07 23:21
amitmistry_petlad 27-Apr-07 23:21 
GeneralRe: Need help in Threading in win32 Pin
amitmistry_petlad 28-Apr-07 1:08
amitmistry_petlad 28-Apr-07 1:08 
GeneralRe: Need help in Threading in win32 Pin
Arman S.28-Apr-07 1:24
Arman S.28-Apr-07 1:24 
As I said in my previous post, only do use AfxBeginThread in MFC based apps. Otherwise use _beginthreadex and not what you are using now (_beginthread). And I guess you are using MFC because you mentioned about listview control...

Anyway, just to be answered;

I faced proble with
_beginthread(functionname,0,argumentlist);


The first param is the controlling function name which should have the following syntax;
DWORD MyThread(PVOID *pParam);

The second param is the stack size. Pass 0 for defaulting.

The third parameter is some address through which you want to pass arguments to MyThread;

struct INFO { // assume you want to pass 3 arguments
int param1;
char param2;
SomeClass *pObject;
};
INFO *pInfo = new INFO;
// initialize pInfo fields
AfxBeginThread(MyThread, 0, (PVOID ) pInfo); // start thread

// Then inside the controlling function
DWORD MyThread(PVOID pParam)
{
INFO *pInfo = (INFO *) pParam;

int p1 = pInfo->param1;
char p2 = pInfo->param2;
SomeClass *p = pInfo->pObject;
// do whatever ...

delete pInfo; // do a proper memory release
return 0;
}

--
=====
Arman

GeneralRe: Need help in Threading in win32 Pin
amitmistry_petlad 28-Apr-07 2:26
amitmistry_petlad 28-Apr-07 2:26 
GeneralRe: Need help in Threading in win32 Pin
Arman S.28-Apr-07 2:35
Arman S.28-Apr-07 2:35 
GeneralRe: Need help in Threading in win32 Pin
amitmistry_petlad 28-Apr-07 20:03
amitmistry_petlad 28-Apr-07 20:03 
GeneralRe: Need help in Threading in win32 Pin
amitmistry_petlad 29-Apr-07 19:10
amitmistry_petlad 29-Apr-07 19:10 
QuestionHow can i solve memory size problem? Pin
$uresh $hanmugam27-Apr-07 22:38
$uresh $hanmugam27-Apr-07 22:38 
QuestionRe: How can i solve memory size problem? Pin
Mark Salsbery29-Apr-07 8:53
Mark Salsbery29-Apr-07 8:53 
Questionfunction arguments Pin
Cmania27-Apr-07 22:12
Cmania27-Apr-07 22:12 
AnswerRe: function arguments Pin
Arman S.27-Apr-07 22:30
Arman S.27-Apr-07 22:30 
QuestionRe: function arguments Pin
Cmania27-Apr-07 22:33
Cmania27-Apr-07 22:33 
AnswerRe: function arguments Pin
MohammadAmiry27-Apr-07 22:47
MohammadAmiry27-Apr-07 22:47 
GeneralRe: function arguments Pin
Arman S.27-Apr-07 22:52
Arman S.27-Apr-07 22:52 
QuestionRe: function arguments Pin
Cmania27-Apr-07 22:56
Cmania27-Apr-07 22:56 
AnswerRe: function arguments Pin
MohammadAmiry27-Apr-07 23:57
MohammadAmiry27-Apr-07 23:57 
AnswerRe: function arguments Pin
cp987628-Apr-07 0:19
cp987628-Apr-07 0:19 
AnswerRe: function arguments Pin
cmk28-Apr-07 13:08
cmk28-Apr-07 13:08 
AnswerRe: function arguments Pin
Mark Salsbery29-Apr-07 8:58
Mark Salsbery29-Apr-07 8:58 
QuestionRead/Write object from/into file?? Pin
$uresh $hanmugam27-Apr-07 21:47
$uresh $hanmugam27-Apr-07 21:47 

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.