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. Update AppName in TaskBar

Update AppName in TaskBar

Scheduled Pinned Locked Moved C / C++ / MFC
c++algorithmsdebuggingquestionannouncement
3 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.
  • L Offline
    L Offline
    leander
    wrote on last edited by
    #1

    I want to force the update of the title of my application which appears in the taskbar. I explain : In my application (MFC), I have a Big Algorithm which take time. In the main loop of this Algorithm, I update the application name to display the percent. (The name look like : "MyAppli - 15%"). The Title of my application is correctly update by windows, but the Title of my application in the taskbar was not update until the end of the algorithm. If I put a breakpoint in my algorithm, visual update the title in the taskbar... So I image, my algorithm use to CPU, to let the taskbar update itself. I have try to add this code in the main loop when I change the title :UInt32 ui32GotMsg; MSG message; SetWindowText( szPercent ); // translate messages while (true) { ui32GotMsg = ::PeekMessage( &message, NULL, 0U, 0U, PM_REMOVE | PM_NOYIELD ); if (0 != ui32GotMsg) { // Translate and dispatch les messages ::TranslateMessage( &message ); ::DispatchMessage( &message ); } else { break; // Stop dispatch and return to the MainLoop. } }
    But, the title in the taskbar doesn't update... I have try to put the code AfxGetApp->OnIdle(0) just after the 'SetWindowText()' but it doesn't work. How I can do to force the update of the title of my application in taskbar ?

    A 1 Reply Last reply
    0
    • L leander

      I want to force the update of the title of my application which appears in the taskbar. I explain : In my application (MFC), I have a Big Algorithm which take time. In the main loop of this Algorithm, I update the application name to display the percent. (The name look like : "MyAppli - 15%"). The Title of my application is correctly update by windows, but the Title of my application in the taskbar was not update until the end of the algorithm. If I put a breakpoint in my algorithm, visual update the title in the taskbar... So I image, my algorithm use to CPU, to let the taskbar update itself. I have try to add this code in the main loop when I change the title :UInt32 ui32GotMsg; MSG message; SetWindowText( szPercent ); // translate messages while (true) { ui32GotMsg = ::PeekMessage( &message, NULL, 0U, 0U, PM_REMOVE | PM_NOYIELD ); if (0 != ui32GotMsg) { // Translate and dispatch les messages ::TranslateMessage( &message ); ::DispatchMessage( &message ); } else { break; // Stop dispatch and return to the MainLoop. } }
      But, the title in the taskbar doesn't update... I have try to put the code AfxGetApp->OnIdle(0) just after the 'SetWindowText()' but it doesn't work. How I can do to force the update of the title of my application in taskbar ?

      A Offline
      A Offline
      Abbas_Riazi
      wrote on last edited by
      #2

      Change your code to this:

      UInt32 ui32GotMsg;
      MSG message;

      // translate messages
      while (true)
      {
      ui32GotMsg = ::PeekMessage( &message, NULL, 0U, 0U, PM_REMOVE | PM_NOYIELD);
      if (ui32GotMsg != 0)
      {
      // Translate and dispatch les messages
      ::TranslateMessage( &message );
      ::DispatchMessage( &message );
      }
      else
      {
      SetWindowText( szPercent );
      }
      }

      I hope this works! A. Riazi

      L 1 Reply Last reply
      0
      • A Abbas_Riazi

        Change your code to this:

        UInt32 ui32GotMsg;
        MSG message;

        // translate messages
        while (true)
        {
        ui32GotMsg = ::PeekMessage( &message, NULL, 0U, 0U, PM_REMOVE | PM_NOYIELD);
        if (ui32GotMsg != 0)
        {
        // Translate and dispatch les messages
        ::TranslateMessage( &message );
        ::DispatchMessage( &message );
        }
        else
        {
        SetWindowText( szPercent );
        }
        }

        I hope this works! A. Riazi

        L Offline
        L Offline
        leander
        wrote on last edited by
        #3

        I have try it, but it doesn't works. (And I must put a break after the SetWindowText( szPercent ); because I must give back CPU time to my algorithm. My code seem like this :

        void BigFunction()
        {
              for(i=0; i
        
        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