cast problem
I am trying to write a section of code that uses a worker thread and
would need a "post message" to post a
"long" integer to the receiving function. However, I am not sure how to
write the cast for the "long" int. Apparently,
the "long" needs to be a pointer since the thread was passed the "this"
pointer for the main dialog. And the "long" is declared in the main dialog
class. If it is declared as a local variable, there is an Assertion Error
after the program is compiled, and a "Start" button is pushed. This button
starts the thread.
So, could anyone correctly write the "cast" statement that would be
needed for this post message. My C++ is not that versatile yet. And I'm
still learning how to use pointers and cast in most situations.
-----------------------------------------
error C2440: 'type cast' : cannot convert from 'long CThreadTestDlg::*' to
'long'
-----------------------------------------
The worker thread section of code:
UINT CThreadTestDlg::Thread1(LPVOID lParam)
{
CThreadTestDlg* pDlg = (CThreadTestDlg *)lParam;
ActxPrg m_ActxPrg; //object declaration
m_ActxPrg.Open(); // open ActxPrg
lResult = m_xActxPrg.MemFunction();
m_ActxPrg.Close(); // close ActxPrg
pDlg->PostMessage(UWM_THREAD_FINISHED, (WPARAM)0, (LPARAM) lResult);
return 0;
}