You cannot pass a member function to CreateThread. The function you pass must be either a function, not a class method, or it has to be static. You can create a static helper function and pass your instance, so that helper can call your class method on your instance, but then you wasted your only parameter on "this" and you have to use a member variable to actually pass anything meaningful to your thread:
Code:
class ScanAction {
public:
void ScanDir(char *root);
private:
LPVOID m_pThreadParams;
static DWORD WINAPI RunLyricsThread(LPVOID params);
DWORD WINAPI LyricsThread(LPVOID params);
};
DWORD WINAPI ScanAction::RunLyricsThread(LPVOID params)
{
return ((ScanAction*)params)->LyricsThread( m_pThreadParams );
}
DWORD WINAPI ScanAction::LyricsThread(LPVOID params)
{
...
}
void ScanAction::ScanDir(char *root)
{
...
m_pThreadParams = params;
CreateThread(NULL , 0 , RunLyricsThread, this, 0 , &dwChildId);
...
}