It will be better if you post a little bit of code. However,
suppose classname is MyClass and your thread name MyThread. You call this thread from your class.
then try this..
_beginthread(MyThread,0,this);
void* MyThread(void* arg)
{
MyClass* newObj = (MyClass* )arg;
newObj->MyArray.add(YourStructure);
}
if this will not work for you then please post some code.
Well, try this code:
#include "stdafx.h"
#include <atlbase.h>
#include <atltime.h>
#include <atlcoll.h>
typedef struct
{
CString FullPath;
CTime StatusDate;
} Item;
class MyClass
{
public:
MyClass();
~MyClass();
void StartThread();
void* MyThread(void* arg);
Item MyItem;
private:
CAtlArray<item> *MyArray;
};
void MyClass::StartThread(void)
{
HANDLE handle;
int val=0;
Item MyNewItem;
wcscpy(MyNewItem.FullPath.GetBuffer(),L"c:\\");
handle = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) &MyClass::MyThread, &MyNewItem, 0, NULL);
if ( handle == NULL) ExitProcess(0);
}
void* MyClass::MyThread(void* arg)
{
Item* newObj = (Item* )arg;
MyArray->Add(*Item);
return TRUE;
}
int _tmain(int argc, _TCHAR* argv[])
{
MyClass *myClass = new MyClass;
myClass->StartThread();
return 1;
}