Can Someone tell why ? & How To Implement Such Behavior if Reqd
I am Trying it To Implement using SetClassLong It Has its Problem
1) The Mouse Click is not Stopped Just the Cursor is Changed
2) It Needs To be Done with every Window & Then restored after the operation
Help Please ...............
Code Example .................
HCURSOR Busy = ::LoadCursor(NULL,IDC_WAIT);
HCURSOR Normal = ::LoadCursor(NULL,IDC_ARROW);
UINT Proc(LPVOID arg)
{
CCursorWithThreadDlg *p=(CCursorWithThreadDlg *)arg;
p->DoSomeWork();
return 0;
}
void CCursorWithThreadDlg::OnButton1()
{
::AfxBeginThread(Proc,this);
}
void CCursorWithThreadDlg::DoSomeWork()
{
// SetClassLong(GetDlgItem(IDC_BUTTON1)->m_hWnd,GCL_HCURSOR,(LONG)Busy);
BeginWaitCursor();
CString data;
for(int i=1;i<=9999;i++)
{
// SetCursor(Busy);
RestoreWaitCursor();
data.Format("%d",i);
this->m_ctrlTest.SetWindowText(data);
}
EndWaitCursor();
// SetClassLong(this->m_hWnd,GCL_HCURSOR,(LONG)Normal);
}
They only work when the main UI thread is not processing messages. As
soon as the UI thread handles a WM_SETCUROR message the default
processing resets the cursor to the window's class default cursor.
If you want to show a different cursor during a long operation when
messages will be processed, handle the WM_SETCURSOR message and change
the cursor from there.
Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.
>.
>