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