ok, that about sums up the problem with the CALLBACK, any idea whats causing the
CreateThread(...) error? m_hThread is a HANDLE..
ok, that about sums up the problem with the CALLBACK, any idea whats causing the
CreateThread(...) error? m_hThread is a HANDLE..
yup, first post, the function call is in aButton::Create(..);
This one???
Code:D:\Programming\C++\aButton.cpp(86) : error C2440: '=' : cannot convert from 'long (__stdcall *(__thiscall aButton::*)(struct HWND__ *,unsigned int,unsigned int,long))(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)' D:\Programming\C++\aButton.cpp(74) : error C2440: 'type cast' : cannot convert from '' to 'unsigned long (__stdcall *)(void *)' None of the functions with this name in scope match the target type
yeah, its the bottom error.. it doesnt make any sense to me.. how can it be ''?
You're passing an incompatible function pointer (Main) in the 3rd argument of CreateThread.
The function needs to be a static (or global) function that looks like
Code:DWORD WINAPI ThreadProc( LPVOID lpParameter );
oh, so pretty much the same thing as the CALLBACK, make it static and set the handle with setwindowlong?
also, i usually pass void functions to createthread and it works.. just not in a class.
You can make it static but you can't set extra memory for threads using SetWindowLong.oh, so pretty much the same thing as the CALLBACK, make it static and set the handle with setwindowlong?
hmm... would it be wrong to close the handle right after i create the thread? i wont need it anyway.. the thread should end whenever the control is destroyed, right?
and by the way, thanks for all the help
IIRC, calling CloseThread() won't terminate the thread so yes, the thread will still run.
But I think you should keep the handle around, because to completely remove a thread object you have to call CloseHandle() after the thread is terminated.
My knowledge in this area is rusty, someone correct me if I'm wrong.