Robert123
August 25th, 2005, 10:07 AM
In my thread function I'm trying to do the following:
DWORD WINAPI ThreadFunc(LPVOID lpParam )
{
Form1 __gc* ObjectPointer = (Form __gc*)lpParam;
ObjectPointer->Write_to_listView();
return 0;
}
I created the thread in _tWinMain as follows
...
Form1 __gc* pNewObject = new Form1;
hThread = CreateThread(NULL,0,ThreadFunc,&pNewObject,0,
&dwThreadId);
...
However when I try to compile, I get the following error message:
'type cast' : cannot convert from 'LPVOID' to 'System::Windows::Forms::Form __gc *'
Cannot convert an unmanaged type to a managed type
Is there any way that I can cast lpParam to a managed type, or should I try something else altogether?
DWORD WINAPI ThreadFunc(LPVOID lpParam )
{
Form1 __gc* ObjectPointer = (Form __gc*)lpParam;
ObjectPointer->Write_to_listView();
return 0;
}
I created the thread in _tWinMain as follows
...
Form1 __gc* pNewObject = new Form1;
hThread = CreateThread(NULL,0,ThreadFunc,&pNewObject,0,
&dwThreadId);
...
However when I try to compile, I get the following error message:
'type cast' : cannot convert from 'LPVOID' to 'System::Windows::Forms::Form __gc *'
Cannot convert an unmanaged type to a managed type
Is there any way that I can cast lpParam to a managed type, or should I try something else altogether?