Hi, I am writing an animation program for work using Visual C++, in a Windows based Environment. In order to get the animation to run smoothly I used 2 extra threads to control the refresh rate and creation of the animation objects (rectangles, circles etc..) To do this I use the Windows API function CreateThread(), this function needs a pointer to a function, where the thread will start. The pointer is of type (LPTHREAD_START_ROUTINE) and the function simply has to be a DWORD AnyFunc(LPVOID param). The thread start function in the test program is global, I was trying to get it to be a public function inside of a class.
The class name is SysAnimation
I created a pointer named
LPTHREAD_START_ROUTINE FuncPtr;
If I use FuncPtr inside of CreateThread() as the 3rd paramter, the program compiles fine.
The function I want to use as the thread start is defined as...
DWORD WINAPI SysAnimation::RefThread(LPVOID param)
I try to set the function pointer inside of the SysAnimation construtor
FuncPtr = RefThread;
When trying to do this conversion, It will not compile saying that it cannot convert
"unsigned long (__stdcall SysAnimation::*)(void *) to unsigned long(__stdcall *)(void *) "
Does anyone know a way to get this function pointer to copy?
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
I can get the program working using a global function that acts as the thread start. However I want to avoid having to use global functions. The only other thing I could think of was having a class, that when it is Instantiated becomes a thread. I know how to do this in java, but not in MS Visual C++
Thanks for any help
The class name is SysAnimation
I created a pointer named
LPTHREAD_START_ROUTINE FuncPtr;
If I use FuncPtr inside of CreateThread() as the 3rd paramter, the program compiles fine.
The function I want to use as the thread start is defined as...
DWORD WINAPI SysAnimation::RefThread(LPVOID param)
I try to set the function pointer inside of the SysAnimation construtor
FuncPtr = RefThread;
When trying to do this conversion, It will not compile saying that it cannot convert
"unsigned long (__stdcall SysAnimation::*)(void *) to unsigned long(__stdcall *)(void *) "
Does anyone know a way to get this function pointer to copy?
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
I can get the program working using a global function that acts as the thread start. However I want to avoid having to use global functions. The only other thing I could think of was having a class, that when it is Instantiated becomes a thread. I know how to do this in java, but not in MS Visual C++
Thanks for any help