Window and Taskbar becomes unresponsive
I have made a RPC server that displays that status of what the client is doing with the application. The RPC server is a simple windows app that draw the text with DrawText along with the task bar icon display a 'busy status' that show a spinning icon to indicate that the client is doing something.
After awhile the windows app will just stop being responsive and the taskbar icon will disappear. The menu bar will also become unusable. I'm not sure what's going on since there are no memory leaks.
Is the issue would be that there is too many WM_PAINT occurring? The client send a text to the server and it can call "UpdateStatus" to tell the server that it need to display the information in the windows app. The server will call "InvalidateRect(m_hWnd, NULL, TRUE);" since the server doesn't know exactly how much string need to be redrawn on the window so I just invalidate all of the window so that the WM_PAINT will get sent to my windows callback and then I just call my "CServer::Paint()".
Code:
void CServer::Paint(void)
{
RECT rt;
HDC hdc;
LOGFONT lf;
PAINTSTRUCT ps;
wstring wstr;
wstr = GetStatus();
hdc = BeginPaint(m_hWnd, &ps);
SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
GetClientRect(m_hWnd, &rt);
DrawText(hdc, wstr.c_str(), wstr.length(), &rt, DT_LEFT);
DeleteObject(SelectObject(hdc, CreateFontIndirect(&lf)));
EndPaint(m_hWnd, &ps);
return;
}