CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Location
    Croatia
    Posts
    192

    [RESOLVED] What changes my cursor to default cursor?

    i use:

    ::SetCursor(::LoadCursorFromFile("res\\cursor1.cur"));

    in OnMouseMove() to set my cursor to "cursor1.cur"
    but when i do anything else (mouse click, rightmouse click) my cursor gets back to a default one. WHO | WHAT | WHEN | WHY | HOW changes that?

    in fact, that kind of "attidude" suits me well but i dont like when someone does something behind my back

    doing MFC, doc/view, MDI

  2. #2
    Join Date
    May 2004
    Location
    Pell City, Alabama
    Posts
    126

    Re: What changes my cursor to default cursor?

    When ever the mouse moves over a particular window there is a windows message called WM_SETCURSOR that is sent to that window. That window handles the message and Calls ::SetCursor to change the cursor.

    That is why you can't just call ::SetCursor and expect the Cursor to change. It will change, but as soon as you touch the mouse or move the cursor, the WM_SETCURSOR message will be called, and the window under the cursor will probably set the cursor back like it was before you set it.

    If you want to change the cursor, you are going to have to handle that message.

    You might want to take a look at MFC's CWaitCursor and how the WM_SETCURSOR message gets handled by the framework.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured