Click here to Skip to main content
15,900,258 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Edit control Pin
Jarley D.G.25-Oct-06 5:20
Jarley D.G.25-Oct-06 5:20 
AnswerRe: Edit control Pin
David Crow25-Oct-06 5:49
David Crow25-Oct-06 5:49 
QuestionCWaitcursor in Thread Pin
Max++25-Oct-06 3:18
Max++25-Oct-06 3:18 
QuestionRe: CWaitcursor in Thread Pin
David Crow25-Oct-06 3:27
David Crow25-Oct-06 3:27 
AnswerRe: CWaitcursor in Thread [modified] Pin
Programm3r25-Oct-06 3:28
Programm3r25-Oct-06 3:28 
AnswerRe: CWaitcursor in Thread Pin
Max++25-Oct-06 4:18
Max++25-Oct-06 4:18 
GeneralRe: CWaitcursor in Thread Pin
David Crow25-Oct-06 5:51
David Crow25-Oct-06 5:51 
AnswerRe: CWaitcursor in Thread Pin
Iain Clarke, Warrior Programmer25-Oct-06 7:19
Iain Clarke, Warrior Programmer25-Oct-06 7:19 
As you've discovered, CWairCursor won't work in a separate thread.

If you look at CWaitCursor, all it does is call SetCursor, and then restore your old one when its destructor is called.

If its in the same thread as the message pump (99.(% the main thread), then no messages are processed, including WM_MOUSEMOVE & WM_SETCURSOR.

If its in a separate thread, then the first time WM_SETCURSOR is processed, your cursor will be reset.


The solution is to override WM_SETCURSOR / OnSetCursor in your main program, or view (as appropriate).

BOOL CMyWndOrView::OnSetCursor (HITTYPE ht, CPoint pt)
{
    if (ht == HTCLIENT && m_bMyThreadIsActive)
    {
        SetCursor (m_hMyThreadyCursor)
        return TRUE;
    }
    else
        return CWndParentClass:OnSetCursor (ht, pt);
}


This is off the top of my head - check the function prototype using MSDN, and you may also need to create the window class using a NULL cursor. See OnPreCreateWindow for MFC.


I hope this guides you in the right direction....


Iain.
Questionhow to load a file from a combo box? Pin
cyn825-Oct-06 3:14
cyn825-Oct-06 3:14 
AnswerRe: how to load a file from a combo box? Pin
Programm3r25-Oct-06 3:17
Programm3r25-Oct-06 3:17 
GeneralRe: how to load a file from a combo box? Pin
cyn825-Oct-06 6:48
cyn825-Oct-06 6:48 
QuestionRe: how to load a file from a combo box? Pin
David Crow25-Oct-06 3:26
David Crow25-Oct-06 3:26 
AnswerRe: how to load a file from a combo box? Pin
cyn825-Oct-06 7:02
cyn825-Oct-06 7:02 
GeneralRe: how to load a file from a combo box? Pin
David Crow25-Oct-06 7:31
David Crow25-Oct-06 7:31 
AnswerRe: how to load a file from a combo box? Pin
toxcct25-Oct-06 3:28
toxcct25-Oct-06 3:28 
AnswerRe: how to load a file from a combo box? Pin
James R. Twine25-Oct-06 3:36
James R. Twine25-Oct-06 3:36 
GeneralRe: how to load a file from a combo box? Pin
cyn825-Oct-06 6:56
cyn825-Oct-06 6:56 
GeneralRe: how to load a file from a combo box? Pin
cyn825-Oct-06 6:57
cyn825-Oct-06 6:57 
AnswerRe: how to load a file from a combo box? Pin
Hamid_RT25-Oct-06 19:49
Hamid_RT25-Oct-06 19:49 
QuestionHow to allocate value to an given ID in the code side? Pin
xiaoke25-Oct-06 3:09
xiaoke25-Oct-06 3:09 
AnswerRe: How to allocate value to an given ID in the code side? Pin
David Crow25-Oct-06 3:13
David Crow25-Oct-06 3:13 
QuestionWinsock2.h -- Arrays Pin
arab_control_agency25-Oct-06 3:03
arab_control_agency25-Oct-06 3:03 
GeneralLogical Drive Name Pin
Monty225-Oct-06 2:22
Monty225-Oct-06 2:22 
GeneralRe: Logical Drive Name Pin
Mila02525-Oct-06 2:41
Mila02525-Oct-06 2:41 
GeneralRe: Logical Drive Name Pin
Monty225-Oct-06 3:07
Monty225-Oct-06 3:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.