Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CWaitCursor doesnot work in thread function

CWaitCursor doesnot work in thread function

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vicky00000
    wrote on last edited by
    #1

    Hai all, CWaitCursor does not work in thread function.How can I change my cursor while i do some lengthy process. Please help me. Thanks to all

    C 1 Reply Last reply
    0
    • V vicky00000

      Hai all, CWaitCursor does not work in thread function.How can I change my cursor while i do some lengthy process. Please help me. Thanks to all

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      Post a message to the main thread and let it to do the stuff. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

      V 1 Reply Last reply
      0
      • C CPallini

        Post a message to the main thread and let it to do the stuff. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

        V Offline
        V Offline
        vicky00000
        wrote on last edited by
        #3

        please clarify , what mwessage and param that i used in Postmemessage

        C 1 Reply Last reply
        0
        • V vicky00000

          please clarify , what mwessage and param that i used in Postmemessage

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          Typically you do something like

          #define WM_MY_CHANGE_CURSOR (WM_APP+1)

          In a header file included both by your main thread source file and by the worker thread one. Then, when appropriate (whenever you need to change the cursor), send the message from the worker thread to the main one, for instance

          PostMessage(hWnd, WM_MY_CHANGE_CURSOR, wParam, lParam);

          Where hWnd is the handle of the main window and wParam, lParam meanings are freely choosen by you (e.g. wParam maybe the index of the intended new cursor). Finally, you properly handle the message (to do the graphics stuff) in the main thread, for instance using MFC ON_MESSAGE mechanism (see [^]). :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups