I want to create a worker thread but i recive an error like this:
my code:
UINT ReadCD(LPVOID lp)
{
.//Some Code//
.
.
return0;
}
.
.
.
AfxBeginThread(ReadCD,NULL);
Error:"error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)"

I have a problem with AfxBeginThread()
AdamDev
unsigned int __cdecl ReadCD(void* pv)
{
}
Speedipus
I try others.But they not work.
I doomed. :(
kfkyle
rico75
static UINT foo(LPVOID poi)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
return 0;
}
CWinThread* pWinThread = AfxBeginThread(foo);
should work!
The function must be static !!!!
R
S.W. Lambert
Almero
PowerCopyDlg.cpp
D:\Tools\Visuall C++\PowerCopy\PowerCopyDlg.cpp(384) : error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)'
Error executing cl.exe.
PowerCopy.exe - 1 error(s), 0 warning(s)
My code:
AfxBeginThread(ReadCD,NULL);
jaebird
UINT __cdecl ReadCD(LPVOID lp)
{
// ...
}
Haggerty
Mathias Vestergaard
He3117, could you post the full error message (if you're building from within the IDE make sure, that you get the error message from the output window and _not_ from the task list/error window). With VC8 you should get you a good error message (good work VC++ FE folks, BTW
-hg
IanHurrell
UINT __cdecl ReadCD(void *)
{
return 0;
}
It works for me! I can even omit __cdecl because it the default in my project!
dariakus
kenny9
Thanks,
Ayman Shoukry
VC++ Team
cool_chandu
But!!!!
I Have a new problem now.
I Cant use my public members(functions or variables) in this function.
look at this:
illegal reference to data member 'CPowerCopyDlg::m_rbuf' in a static member function
Now it send me 204 errors like this!!!